Skip to content

Fix Blazor WebAssembly diagnostics defaults to use the defined opt-out property - #55447

Merged
javiercn merged 2 commits into
mainfrom
copilot/fix-diagnostics-feature-switches
Jul 24, 2026
Merged

javiercn merged 2 commits into
mainfrom
copilot/fix-diagnostics-feature-switches

Conversation

Copilot AI commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Blazor WebAssembly diagnostics defaults were wired to two different property names. The SDK set BlazorWebAssemblyDiagnosticsEnabled, but the default conditions for MetricsSupport, EventSourceSupport, and HttpActivityPropagationSupport checked BlazorWasmDiagnosticsEnabled, so those switches never defaulted on.

  • SDK property wiring

    • Update Microsoft.NET.Sdk.BlazorWebAssembly.Current.props so all three diagnostics feature switches key off BlazorWebAssemblyDiagnosticsEnabled
    • Align the comment/documented opt-out property with the actual property name
  • Regression coverage

    • Add a focused Blazor WebAssembly test that verifies:
      • default evaluation enables all three switches
      • setting BlazorWebAssemblyDiagnosticsEnabled=false disables all three
<BlazorWebAssemblyDiagnosticsEnabled Condition="'$(BlazorWebAssemblyDiagnosticsEnabled)' == ''">true</BlazorWebAssemblyDiagnosticsEnabled>
<MetricsSupport Condition="'$(MetricsSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</MetricsSupport>
<EventSourceSupport Condition="'$(EventSourceSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</HttpActivityPropagationSupport>

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
3 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Fix Blazor WASM diagnostics feature switches default behavior Fix Blazor WebAssembly diagnostics defaults to use the defined opt-out property Jul 24, 2026
Copilot AI requested a review from javiercn July 24, 2026 00:13
@javiercn
javiercn marked this pull request as ready for review July 24, 2026 06:39
@javiercn
javiercn requested a review from a team as a code owner July 24, 2026 06:39
Copilot AI review requested due to automatic review settings July 24, 2026 06:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

Fixes a property-name mismatch in the Blazor WebAssembly SDK props that prevented diagnostics-related feature switches from defaulting on, and adds regression coverage to validate the resolved MSBuild properties.

Changes:

  • Align MetricsSupport, EventSourceSupport, and HttpActivityPropagationSupport default conditions to use BlazorWebAssemblyDiagnosticsEnabled.
  • Update the in-file comment to document the correct opt-out property name.
  • Add an integration test that validates the default-on behavior and the opt-out behavior via -getProperty evaluation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/VanillaWasmTests.cs Adds a test that queries MSBuild-resolved properties (JSON) to assert default/opt-out behavior for WASM diagnostics feature switches.
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.Current.props Fixes the gating property name mismatch so the diagnostics feature switches correctly default on, and updates the comment accordingly.

Comment on lines 47 to +50
<BlazorWebAssemblyDiagnosticsEnabled Condition="'$(BlazorWebAssemblyDiagnosticsEnabled)' == ''">true</BlazorWebAssemblyDiagnosticsEnabled>
<MetricsSupport Condition="'$(MetricsSupport)' == '' and '$(BlazorWasmDiagnosticsEnabled)' == 'true'">true</MetricsSupport>
<EventSourceSupport Condition="'$(EventSourceSupport)' == '' and '$(BlazorWasmDiagnosticsEnabled)' == 'true'">true</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == '' and '$(BlazorWasmDiagnosticsEnabled)' == 'true'">true</HttpActivityPropagationSupport>
<MetricsSupport Condition="'$(MetricsSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</MetricsSupport>
<EventSourceSupport Condition="'$(EventSourceSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == '' and '$(BlazorWebAssemblyDiagnosticsEnabled)' == 'true'">true</HttpActivityPropagationSupport>
@javiercn
javiercn merged commit b3edf14 into main Jul 24, 2026
30 checks passed
@javiercn
javiercn deleted the copilot/fix-diagnostics-feature-switches branch July 24, 2026 08:11
@javiercn

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 26, 2026
danroth27 added a commit to danroth27/BlazorStandaloneAspireDemo that referenced this pull request Jul 28, 2026
- Gateway circular-DI crash: microsoft/aspire#18272 (the Aspire-side gateway is a
  separate forked Gateway.cs.in, so dotnet/aspnetcore#67048 never applied to it);
  unification tracked by dotnet/aspnetcore#67095 (.NET 12 Planning).
- WASM diagnostics: name mismatch already fixed by dotnet/sdk#55447, post-Preview 6.
  The csproj evaluation-order half remains unfixed.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 10309464-dc03-4b89-a45a-8ffb14dc062d
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.

Blazor WASM diagnostics feature switches never default on (BlazorWasmDiagnosticsEnabled vs BlazorWebAssemblyDiagnosticsEnabled property mismatch)

4 participants