Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Description

Adds telemetry to capture effective values of key WASM/Blazor publish configuration properties (globalization mode, boot config shape, fingerprinting, preload behavior, bundler friendliness) to inform defaults and compatibility decisions.

Changes

  • Added _WasmPublishTelemetry target in Microsoft.NET.Sdk.WebAssembly.Browser.targets

    • Runs AfterTargets="GeneratePublishWasmBootJson" when all normalized properties are resolved
    • Skips nested publish via Condition="'$(WasmBuildingForNestedPublish)' != 'true'"
    • Emits AllowEmptyTelemetry event named WasmPublishConfig
  • Captures 9 properties using normalized internal values where applicable:

    • InvariantTimezone (derived from BlazorEnableTimeZoneSupport)
    • InvariantGlobalization (_WasmInvariantGlobalization)
    • BlazorWebAssemblyLoadAllGlobalizationData (_BlazorWebAssemblyLoadAllGlobalizationData)
    • WasmEnableWebcil (_WasmEnableWebcil)
    • WasmInlineBootConfig (_WasmInlineBootConfig)
    • OverrideHtmlAssetPlaceholders (raw value)
    • WasmFingerprintBootConfig (_WasmFingerprintBootConfig)
    • WasmPreloadAssets (_WasmPreloadAssets)
    • WasmBundlerFriendlyBootConfig (_WasmBundlerFriendlyBootConfig)

Notes

Event name WasmPublishConfig may require SDK allow-listing for telemetry forwarding. Follows existing patterns from ReadyToRun and WorkloadPublishProperties events.

No PII—only boolean configuration flags.

Original prompt

Issue: Add publish-time telemetry for key WebAssembly/Blazor config properties (dotnet/runtime Wasm SDK targets)

Repo/area: dotnet/runtimesrc/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Motivation: We want visibility into which major WASM publish configuration knobs are actually being used in the wild (globalization mode, boot config shape, fingerprinting and preload behavior, bundler friendliness), to guide defaults, compatibility decisions, and performance work.

Properties to capture (publish scenarios)

Please add publish-time telemetry that captures the effective values (after defaults/normalization where applicable) for:

  • InvariantTimezone
  • InvariantGlobalization
  • BlazorWebAssemblyLoadAllGlobalizationData
  • WasmEnableWebcil
  • WasmInlineBootConfig
  • OverrideHtmlAssetPlaceholders
  • WasmFingerprintBootConfig
  • WasmPreloadAssets
  • WasmBundlerFriendlyBootConfig

Notes on where they appear / are derived in the targets:

  • InvariantTimezone is set based on BlazorEnableTimeZoneSupport (when tz support is disabled, timezone becomes invariant).
  • InvariantGlobalization + BlazorWebAssemblyLoadAllGlobalizationData drive ICU/globalization behavior (and warnings/validation).
  • WasmEnableWebcil controls DLL → WebCIL conversion and affects publish asset composition.
  • WasmInlineBootConfig, WasmFingerprintBootConfig, OverrideHtmlAssetPlaceholders, WasmPreloadAssets, and WasmBundlerFriendlyBootConfig control boot config format and static web asset fingerprinting/preload behavior.
  • Several of these are normalized to internal _Wasm* properties in _ResolveWasmConfiguration (e.g., _WasmEnableWebcil, _WasmInlineBootConfig, _WasmFingerprintBootConfig, _WasmPreloadAssets, _WasmBundlerFriendlyBootConfig). Telemetry should prefer the normalized/effective values.

When to emit

  • Emit telemetry on publish, not build.
  • Ideal hook point is after publish inputs are finalized (e.g., after ProcessPublishFilesForWasm / GeneratePublishWasmBootJson, or simply AfterTargets="Publish" if values are already stable).
  • Ensure it does not run during nested publish scenarios if those are not representative (consider Condition="'$(WasmBuildingForNestedPublish)' != 'true'").

Event shape / requirements

  • Use the SDK’s MSBuild telemetry mechanism (the CLI side typically forwards only allow-listed events), so either:
    • reuse an existing allow-listed event name if appropriate, or
    • coordinate adding a new allow-listed event name so it is not dropped.
  • Payload should be key/value pairs for the properties above, using the effective values (e.g., _WasmPreloadAssets rather than raw WasmPreloadAssets when defaults apply).

Acceptance criteria

  • Telemetry is emitted once per publish (non-nested publish) for WASM projects using this targets file.
  • Captures the nine properties listed above as strings (true/false/null as applicable).
  • Verified via a test or local reproduction that the event is produced and includes these keys.
  • No PII is collected (these are feature/config flags only).

If you want, I can also suggest a concrete event name and the exact MSBuild target placement in this file that minimizes duplicate events (nested publish) and ensures values are fully resolved.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…rties

Co-authored-by: maraf <10020471+maraf@users.noreply.github.com>
Copilot AI changed the title [WIP] Add publish-time telemetry for WebAssembly config properties Add publish-time telemetry for WebAssembly/Blazor configuration properties Jan 23, 2026
Copilot AI requested a review from maraf January 23, 2026 09:54
@maraf maraf changed the title Add publish-time telemetry for WebAssembly/Blazor configuration properties [browser] Add publish-time telemetry for WebAssembly configuration properties Jan 23, 2026
@maraf maraf added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm labels Jan 23, 2026
@maraf maraf added this to the 11.0.0 milestone Jan 23, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@maraf maraf requested a review from lewing January 23, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants