ILayoutFrameChannel Interface#
Server-to-renderer push channel held by an ILayoutLifecycleHandler for the life of one renderer instance. The host realizes the channel using whatever mechanism is appropriate for the isolation boundary; extensions see only this contract.
public interface ILayoutFrameChannel
Properties#
FrameInstanceId Property#
Host-allocated, opaque token identifying the renderer instance this channel writes to. Stable for the life of one mount.
string FrameInstanceId { get; }
Property Value#
IsAlive Property#
Whether the channel is still attached to a live renderer. Flips to
false before OnRendererUnmountedAsync(LayoutRendererUnmountContext)
is invoked. Once it is false, PostMessageAsync(string, object, CancellationToken) throws
System.InvalidOperationException rather than dropping the message, so a
caller that posts from a callback able to outlive the renderer (for example a
variable-changed handler that can race the unmount) should check this property
first.
bool IsAlive { get; }
Property Value#
Methods#
PostMessageAsync(string, object, CancellationToken) Method#
Posts a typed message to the renderer. The host prefixes the supplied
type with "ext/" before delivery.
System.Threading.Tasks.Task PostMessageAsync(string type, object? payload, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));
Parameters#
type System.String
payload System.Object
ct System.Threading.CancellationToken
Returns#
Exceptions#
System.ArgumentException
type is null or empty, or is in the reserved verso/
namespace, which is held for framework messages (the host adds the ext/
prefix automatically, so extensions never supply it).
System.InvalidOperationException
The channel is no longer attached to a live renderer
(IsAlive is false).
Remarks#
A dead channel or an invalid type is never silently dropped: both throw synchronously, before the returned task is awaited. Guard with IsAlive when posting from a callback that can run after the renderer has unmounted.