Skip to content

[browser][coreclr] Investigate five additional assemblies retained in trimmed Blazor WebAssembly publishes #135222

Closed

Description

@maraf

Description

Migrating the SDK's Blazor WebAssembly integration tests from Mono to CoreCLR exposes a consistent difference in the trimmed managed assembly closure. CoreCLR publishes retain these five assemblies that are absent from the existing Mono-based publish baselines:

  • System.Collections.Immutable.dll
  • System.Diagnostics.StackTrace.dll
  • System.IO.Compression.dll
  • System.IO.MemoryMappedFiles.dll
  • System.Reflection.Metadata.dll

These assemblies are served as their corresponding WebCIL .wasm files. This issue concerns the underlying managed assemblies being retained, not compression or static-asset packaging.

Please investigate what roots these assemblies in the CoreCLR browser configuration and whether those dependencies can be removed so the linker can eliminate them. The CI evidence establishes the assembly-set difference; we have not yet identified the dependency/root chain or established that all five assemblies are unnecessary.

Reproduction and environment

The migration is in dotnet/sdk#56461. The shared test-project setup sets UseMonoRuntime=false for the current target framework.

Publish the SDK test assets BlazorWasmMinimal or BlazorHosted with CoreCLR and trimming enabled, then inspect the linked DLL closure and published WebCIL assembly set:

dotnet publish -c Debug -p:UseMonoRuntime=false -p:PublishTrimmed=true -p:PublishReadyToRun=false -bl:publish.binlog

Compare with the equivalent Mono publish. This difference appears on the first publish, without requiring a prior publish or stale intermediate outputs.

Observed environment in SDK build 1619963:

  • Application target framework: net11.0; test runner: net12.0.
  • CoreCLR runtime pack: Microsoft.NETCore.App.Runtime.browser-wasm/12.0.0-alpha.1.26473.114.
  • WebAssembly SDK pack and ILLink tasks: 12.0.0-alpha.1.26473.114.
  • SDK: 12.0.100-ci.
  • MSBuild: 18.12.0-1.26473.114+c567e8ff1.
  • Trimming and WebCIL enabled; ReadyToRun disabled.

CI evidence

The same five additional assemblies are reported by seven distinct publish-manifest tests across Linux, macOS, Windows, and Windows FullFramework (28 failing executions):

  • BlazorWasmStaticWebAssetsIntegrationTest.StaticWebAssets_PublishMinimal_Works
  • BlazorWasmStaticWebAssetsIntegrationTest.StaticWebAssets_Publish_Hosted_Works
  • BlazorWasmStaticWebAssetsIntegrationTest.StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets
  • WasmJsModulesIntegrationTests.Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonManifest
  • WasmJsModulesIntegrationTests.JsModules_CanHaveDifferentBuildAndPublishModules
  • WasmJsModulesIntegrationTests.JsModules_CanCustomizeBlazorInitialization
  • WasmJsModulesIntegrationTests.JsModules_Hosted_CanCustomizeBlazorInitialization

The publish commands succeed. The tests fail when comparing staticwebassets.publish.json against the Mono-based expectations. Although the first reported mismatch is in compressed representations, those entries represent the additional published managed assemblies listed above. The unexpected set is identical across all seven tests and four CI configurations.

Representative first-publish binlog for StaticWebAssets_PublishMinimal_Works.

Scope

Determine the CoreCLR-specific roots/dependencies retaining the five assemblies and remove unnecessary retention where possible. If any retention is intentional and necessary, document the reason so the SDK publish baselines can be updated knowingly.

This is separate from the repeated-publish assembly-loss bug in #135218, and from the runtime-pack C++ header and intermediate JavaScript source-map filtering changes.

Note

This issue description was generated with the assistance of GitHub Copilot.

Activity

  1. added this to the 12.0.0 milestone on Oct 5, 2026
  2. added
    arch-wasm
    os-browser
    on Oct 5, 2026
  3. dotnet-policy-service commented on Oct 5, 2026

    @dotnet-policy-service
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-Build-monoos-browser

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions