Summary
Consider enabling MetricsSupport and EventSourceSupport MSBuild properties by default for Blazor WebAssembly projects to support OpenTelemetry metrics instrumentation out of the box.
Background
Currently, to enable OpenTelemetry metrics in Blazor WebAssembly, developers must manually add MSBuild properties to their .csproj:
<PropertyGroup>
<!-- Enable WebAssembly diagnostics for OpenTelemetry metrics -->
<!-- See: https://learn.microsoft.com/aspnet/core/blazor/performance/webassembly-event-pipe-diagnostics -->
<MetricsSupport>true</MetricsSupport>
<EventSourceSupport>true</EventSourceSupport>
</PropertyGroup>
Without these properties, runtime instrumentation and metrics don't work in WebAssembly, making Aspire integration incomplete.
Proposal
Consider enabling these properties by default in the Blazor WebAssembly SDK, similar to how other diagnostic features are enabled by default in ASP.NET Core projects.
Options
- Enable by default for all WASM projects - Simplest, but may have size/performance implications
- Enable by default when OpenTelemetry packages are referenced - Conditional enablement
- Enable by default in Aspire-integrated projects - Scoped to Aspire scenarios only
Considerations
- App size impact: These properties may increase the final WASM bundle size
- Performance: Need to measure any runtime overhead
- Discoverability: Currently, developers often don't know these are required until metrics don't work
Documentation
Related Issues
Part of .NET 11.0 Blazor + Aspire integration improvements
Summary
Consider enabling
MetricsSupportandEventSourceSupportMSBuild properties by default for Blazor WebAssembly projects to support OpenTelemetry metrics instrumentation out of the box.Background
Currently, to enable OpenTelemetry metrics in Blazor WebAssembly, developers must manually add MSBuild properties to their
.csproj:Without these properties, runtime instrumentation and metrics don't work in WebAssembly, making Aspire integration incomplete.
Proposal
Consider enabling these properties by default in the Blazor WebAssembly SDK, similar to how other diagnostic features are enabled by default in ASP.NET Core projects.
Options
Considerations
Documentation
Related Issues
Part of .NET 11.0 Blazor + Aspire integration improvements