Skip to content

Rewrite the Blazor integration page - #209

Merged
tillig merged 1 commit into
mainfrom
feature/blazor-docs
Sep 2, 2026
Merged

tillig merged 1 commit into
mainfrom
feature/blazor-docs

Conversation

@tillig

@tillig tillig commented Sep 2, 2026

Copy link
Copy Markdown
Member

Fixes #117.

Why

The page was written against .NET 5 and said so out loud: "This example for WebAssembly works as of March 30, 2021 with .NET 5." It framed Blazor as "two hosting models," which predates the Blazor Web App and render modes, and left a dangling Example: where a sentence had been split.

A broken link that -W cannot catch

`ASP.NET Core 3 <aspnetcore>`_

That's external-link syntax with a relative target, so docutils treats aspnetcore as a URI and emits:

<a href="aspnetcore">ASP.NET Core 3</a>

An extensionless relative link that 404s. The markup is perfectly valid RST, so Sphinx has nothing to warn about — it's only visible in the output. Now a :doc: reference, resolving to aspnetcore.html.

This is the second defect class I've hit that a clean build can't detect, after the nested inline markup on #204. As with that one, I scanned every page for it rather than fixing the single instance: `text <target>`_ where the target has no URI scheme. One instance existed, this one. Both scans now run before I push.

Reorganized by what decides the answer

The page is now structured by where the code runs, because that's what determines the wiring — not by hosting model:

  • Server-side Blazor, and the server project of a Blazor Web App, are ordinary ASP.NET Core hosting, so the page points at the ASP.NET Core guidance rather than restating it.
  • WebAssembly needs WebAssemblyHostBuilder.ConfigureContainer, because there is no Host property to attach a service provider factory to. That's the actual reason the two differ, and it wasn't stated.

Two things added that a reader can act on

A Blazor Web App with WebAssembly interactivity has two projects, so two containers. Registrations made in the server project are not visible to components rendered on the client, so anything both sides resolve has to be registered in both. That's the kind of thing you otherwise discover through a confusing runtime failure.

WebAssembly publishes with trimming enabled, which is a problem for a container that locates constructors by reflection. Points at the trimming page rather than duplicating it.

Verification

Both AutofacServiceProviderFactory constructors were checked against source — the existing sample's use of the configuration-action overload was correct, so it's kept rather than churned. There's no Blazor project in the Examples repo (checked), so no example link to add.

sphinx -b html -W --keep-going, doc8, pre-commit clean. Nested-markup and bad-link scans clean across all pages. Rendered HTML checked, including confirming the repaired reference now emits aspnetcore.html.

Fixes #117.

The page was written against .NET 5 and said so: "This example for WebAssembly
works as of March 30, 2021 with .NET 5." It also framed Blazor as two hosting
models, which predates the Blazor Web App and its render modes, and left a
dangling "Example:" where a sentence had been split.

It also carried a broken link. "`ASP.NET Core 3 <aspnetcore>`_" is
external-link syntax with a relative target, so docutils treated "aspnetcore"
as a URI and emitted href="aspnetcore" - an extensionless relative link that
404s. Sphinx cannot warn about this, because the markup is valid; it is only
visible in the output. It is now a :doc: reference and resolves to
aspnetcore.html. A scan of every page found no other instance.

The page is now organized by where the code runs rather than by hosting model,
which is what actually decides the wiring: server-side Blazor and the server
project of a Blazor Web App are ordinary ASP.NET Core hosting and just point at
that page, while WebAssembly needs WebAssemblyHostBuilder.ConfigureContainer
because there is no Host property to attach a factory to.

Adds two things a reader can act on. A Blazor Web App with WebAssembly
interactivity has two projects and therefore two containers, so anything both
sides resolve has to be registered twice - registrations on the server are not
visible to components rendered on the client. And WebAssembly publishes with
trimming on, which is a problem for a container that finds constructors by
reflection, so the page points at the trimming guidance.

Both AutofacServiceProviderFactory constructors were checked against the source;
the existing sample's use of the configuration-action overload was correct and
is kept.
@tillig
tillig merged commit 85a341a into main Sep 2, 2026
2 checks passed
@tillig
tillig deleted the feature/blazor-docs branch September 2, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Blazor integration docs with the latest method signatures

1 participant