skip to content

Blazor

Blazor builds web UI from C# Razor components that run on the server, on WebAssembly in the browser, or both in one Blazor Web App. Interviewers probe render modes and where state lives.

on this pageshow

explore

questions

page 2 of 2

In a Blazor Web App with WebAssembly interactivity, what do AddAuthenticationStateSerialization and AddAuthenticationStateDeserialization do, and what are their limits?

level: seniorimportance: should knowfreq 36%

basics

~20 s

AddAuthenticationStateSerialization persists the server's authentication state into the prerendered page; AddAuthenticationStateDeserialization registers a client AuthenticationStateProvider that reads it back. The copy holds name and role claims by default, never changes until a full reload, and authenticates nothing.

open as a page

In a Blazor Web App, how does [CascadingParameter] find a CascadingValue, and when would you use IsFixed or AddCascadingValue instead of the component?

level: seniorimportance: should knowfreq 36%

basics

~20 s

A [CascadingParameter] property receives the value from the closest ancestor CascadingValue of a matching type, or with a matching Name. IsFixed="true" skips change tracking for values that never change; AddCascadingValue registers a root-level value through DI that also reaches interactive components across render mode boundaries.

open as a page

In a Blazor component list, what do @key and @ref do, and what goes wrong with duplicate keys or a @ref read before rendering?

level: seniorimportance: should knowfreq 40%

basics

~20 s

@key makes Blazor match list items by a value instead of by position, so each row keeps its own element or component instance; duplicate keys among siblings throw. @ref stores a reference to an element or component instance, which is null until the component has rendered.

open as a page

In a Blazor Web App, what does EditForm's Enhance parameter change for a statically rendered form, and how does an interactive form submit instead?

level: seniorimportance: should knowfreq 34%

basics

~20 s

Enhance adds data-enhance, so a static SSR form posts through fetch and Blazor patches the response into the page instead of reloading it. An interactive form sends no HTTP POST at all: submit is an event handled in .NET.

open as a page

A statically rendered Blazor Web App page posts a volunteer sign-up EditForm and gets a 400 or loses the typed values; how do FormName and [SupplyParameterFromForm] fix it?

level: seniorimportance: should knowfreq 48%

basics

~20 s

Under static SSR each submit is a new HTTP POST to the page. FormName tells Blazor which form's handler to run, and [SupplyParameterFromForm] maps the posted fields onto the model property; without them the post is rejected or the values are lost.

open as a page

In a Blazor Web App, how do you load a collocated JavaScript module as an IJSObjectReference, and dispose it safely when the trail map component is removed?

level: seniorimportance: should knowfreq 46%

basics

~10 s

Call JS.InvokeAsync<IJSObjectReference>("import", "./Components/Trails/TrailMap.razor.js") after first render and invoke the module's exports. Implement IAsyncDisposable: tell the module to tear down the map, then DisposeAsync the reference, catching JSDisconnectedException when the circuit is gone.

open as a page

In a Blazor weather widget that polls on a timer and holds a JavaScript chart, how should IAsyncDisposable be implemented, and when does Blazor call it?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Add @implements IAsyncDisposable and, in DisposeAsync, cancel pending work, stop the timer, unsubscribe from service events and release JavaScript objects. Blazor calls it when the component leaves the UI or, on the server, when its circuit is torn down; with both interfaces only DisposeAsync runs.

open as a page

In Blazor, how do StateHasChanged, ShouldRender and the render tree diff decide what a component sends to the DOM, and when is overriding ShouldRender worth it?

level: seniorimportance: should knowfreq 34%

basics

~20 s

StateHasChanged queues one render unless one is already pending; ShouldRender can veto it except on the first render. A render rebuilds the component's render tree and diffs it against the previous one, so only changed elements, attributes and text are sent as DOM edits.

open as a page

In a Blazor Web App, why does a static page that passes ChildContent to a child with @rendermode InteractiveServer throw, and what other render-mode boundary rules apply?

level: seniorimportance: should knowfreq 38%

basics

~20 s

A render mode on a child starts a new boundary whose parameters are serialized into the page for the interactive runtime. A RenderFragment is a delegate, arbitrary code, so it cannot be serialized and Blazor throws an InvalidOperationException.

open as a page

In a Blazor Web App, how does enhanced navigation work, what can it break, and how do you opt a link or page out of it?

level: seniorimportance: should knowfreq 36%

basics

~20 s

Enhanced navigation lets blazor.web.js intercept an internal link, fetch the page and patch the returned HTML into the current DOM instead of loading a new document. Turn it off per link or subtree with data-enhance-nav="false", or with forceLoad in code.

open as a page

In ASP.NET Core 10 Blazor, how do Router's NotFoundPage and NavigationManager.NotFound() handle a plant id that does not exist, across render modes?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Router.NotFoundPage names a routable component shown when nothing matches; a page calls NavigationManager.NotFound() when its data is missing. Under static SSR and prerendering that sets a 404 and renders the page; interactively only global routers show it.

open as a page

On Blazor Interactive Server, what happens to a user's circuit and cake basket when the connection drops, and what do CircuitOptions and .NET 10 circuit persistence change?

level: seniorimportance: should knowfreq 38%

basics

~20 s

The server keeps a disconnected circuit, by default up to 100 for 3 minutes, while the reconnect UI retries; reconnecting in time loses nothing. In .NET 10, an evicted or paused circuit's [PersistentState] values can resume into a new circuit unless the page reloads.

open as a page

In ASP.NET Core 10 Blazor, how does [PersistentState] stop a prerendered component from loading its data twice, and what code did it replace?

level: seniorimportance: should knowfreq 45%

basics

~20 s

A prerendered component initializes twice: once on the server for HTML, then again when it becomes interactive. [PersistentState] on a public property serializes its prerendered value into the page and restores it before the interactive OnInitializedAsync, so Cakes ??= await Load() skips the second load.

open as a page

For an employee self-service portal built as a .NET 10 Blazor Web App, mostly static pages plus a few interactive widgets, how would you choose render modes?

level: principalimportance: should knowfreq 30%

basics

~20 s

Default to static SSR for read-mostly pages and put an interactive mode only on the widgets that need it, choosing Server, WebAssembly or Auto from latency, concurrent users, offline needs and data access. Revisit if most pages become interactive or the portal must work offline.

open as a page

In a Blazor Web App, what is a JavaScript initializer module, and which of its exported functions run before and after Blazor starts?

level: middleimportance: nice to knowfreq 16%

basics

~20 s

A JS initializer is a module named {ASSEMBLY NAME}.lib.module.js in wwwroot that Blazor imports at startup. In a Blazor Web App it may export beforeWebStart and afterWebStarted, plus per-runtime hooks such as beforeServerStart or afterWebAssemblyStarted.

open as a page

In Blazor WebAssembly, what do the [JSImport] and [JSExport] attributes offer over IJSRuntime, and why can they not run in an Interactive Server component?

level: seniorimportance: nice to knowfreq 18%

basics

~20 s

[JSImport] and [JSExport] are the .NET WebAssembly runtime's own interop: source-generated, in-process, often synchronous calls with typed marshalling instead of JSON. They exist only in the browser runtime, so server-run code, including Interactive Server components, cannot use them.

open as a page

showing 31–46 of 46