Interface IComponentTraceSink

The seam an instrumented component's emitted lifecycle proxy reports into. It lives in this authoring assembly on purpose: the render engine loads a user's built assembly into a dedicated ComponentAssemblyLoadContext that defers BlazorToolkit.Previews* to the default context, so the dynamically-emitted proxy (in the default context) and every other party agree on the same IComponentTraceSink type across the load-context boundary. Placing it in the engine (also a BlazorToolkit.Previews* name) would work too, but the public authoring package is the natural, always-loaded home for the shared contract.

Implementations are supplied by the engine and registered per render (static: one per preview provider; interactive: one per circuit). The proxy calls these on the render dispatcher, so implementations only need to be resilient to being read from another thread (the trace is harvested after the render quiesces).

Namespace: BlazorToolkit.Previews
Assembly: BlazorToolkit.Previews.dll
Syntax
public interface IComponentTraceSink

Methods

Record(object, string, string, string?)

Records one lifecycle invocation. instance is the component instance (used to number re-renders per instance); component is its simple name; phase is the lifecycle method (SetParametersAsync, OnInitialized, OnAfterRenderAsync, …); paramsJson is a JSON snapshot of the parameters for SetParametersAsync (and the firstRender flag for the after-render phases), else null.

Declaration
void Record(object instance, string component, string phase, string? paramsJson)
Parameters
Type Name Description
object instance
string component
string phase
string paramsJson

RecordRender(object, string)

Records that instance (simple name component) rendered once (its BuildRenderTree ran).

Declaration
void RecordRender(object instance, string component)
Parameters
Type Name Description
object instance
string component

RecordUntraced(string, string)

Records a component the toolkit deliberately did not instrument, with a plain-language reason, so an empty subtree is explained rather than mistaken for a broken feature.

Declaration
void RecordUntraced(string component, string reason)
Parameters
Type Name Description
string component
string reason