Skip to content

[release/11.0] Fix support for unions with null values as root component parameters - #69316

Merged
wtgodbe merged 1 commit into
release/11.0from
backport/pr-69198-to-release/11.0
Sep 16, 2026
Merged

wtgodbe merged 1 commit into
release/11.0from
backport/pr-69198-to-release/11.0

Conversation

@oroztocil

@oroztocil oroztocil commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Backport of #69198 to release/11.0

/cc @oroztocil

Fix support for unions with null values as root component parameters

Fix nullable C# union parameters in Blazor WebAssembly

Description

Blazor can render a component as HTML on the server and then activate it in the browser using WebAssembly. Activation fails when a C# union parameter is created by passing null to a nullable case type, for example (int?)null in union Value(int?, string).

This PR fixes parameter restoration in such cases and adds unit and end-to-end tests.

Fixes #68798

Customer Impact

.NET 11 applications using nullable C# union parameters can display the server-rendered HTML but fail to activate the component in the browser. The browser reports that the parameter value could not be parsed. Interactive Auto is also affected when it selects WebAssembly.

Regression?

  • Yes
  • No

This is a support gap in the new .NET 11 union functionality rather than a regression from a previously supported release.

Risk

  • High
  • Medium
  • Low

The change is internal and does not affect public API. Tests cover null and non-null union values, ordinary null parameters, and both Server and WebAssembly render modes.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

When servicing release/2.3

  • Make necessary changes in eng/PatchConfig.props

@oroztocil
oroztocil marked this pull request as ready for review September 15, 2026 13:03
Copilot AI lite review requested due to automatic review settings September 15, 2026 13:03
@oroztocil
oroztocil requested a review from a team as a code owner September 15, 2026 13:03
@oroztocil oroztocil added Servicing-consider Shiproom approval is required for the issue area-blazor Includes: Blazor, Razor Components labels Sep 15, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @oroztocil. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The fix is covered by unit and end-to-end tests, with no unresolved blocking issues identified.

Pull request overview

Fixes WebAssembly restoration of nullable union parameters whose value is null during interactive root component activation.

Changes:

  • Initializes and injects JSON serialization options.
  • Routes null-valued unions through the appropriate converter.
  • Adds unit, component, and Server/WebAssembly end-to-end tests.
File summaries
File Summary
src/Shared/Components/WebAssemblyComponentSerializationSettings.cs Initializes serializer options.
src/Components/WebAssembly/WebAssembly/test/WebAssemblyComponentParameterDeserializerUnionTest.cs Adds union deserialization tests.
src/Components/WebAssembly/WebAssembly/src/Prerendering/WebAssemblyComponentParameterDeserializer.cs Restores null-valued union parameters.
src/Components/test/testassets/TestContentPackage/UnionParameterCounter.razor Adds a union parameter test component.
src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/CallSiteInteractiveComponents.razor Adds union parameter scenarios and render modes.
src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs Adds Server and WebAssembly end-to-end coverage.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@artl93 artl93 removed their assignment Sep 16, 2026
@kotlarmilos kotlarmilos added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 16, 2026
@kotlarmilos
kotlarmilos self-requested a review September 16, 2026 14:38
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @oroztocil. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@wtgodbe
wtgodbe merged commit 3aafe0c into release/11.0 Sep 16, 2026
51 of 52 checks passed
@wtgodbe
wtgodbe deleted the backport/pr-69198-to-release/11.0 branch September 16, 2026 18:33
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants