Skip to content

[browser][CoreCLR][trimmed R2R] Reflection metadata tests lose pseudo-attribute and forwarder data #134263

Closed

Description

@lewing

Description

Trimmed browser-Wasm CoreCLR ReadyToRun exposes reflection metadata differences in two test assemblies:

  • System.Reflection.MetadataLoadContext.Tests: three MarshalAsAttribute pseudo-custom-attribute cases lose expected metadata values.
  • System.Reflection.Tests: AssemblyGetForwardedTypesLoadFailure no longer observes the expected forwarded-type load failure shape.

Found while bringing up #133193.

Reproduction Steps

Build and run the affected library tests for browser-Wasm CoreCLR with:

TestWasmReadyToRun=true
EnableAggressiveTrimming=true
RuntimeFlavor=CoreCLR
Configuration=Release

The failures reproduced in PR #133656, Azure DevOps build 1603190, Helix job 3158c862-61f5-4cf9-bb24-6ecdf2cfe895, work items WasmTestOnChrome-CLR-ST-Batch-10 and Batch-13.

Expected behavior

MetadataLoadContext preserves the expected MarshalAsAttribute pseudo-attribute fields, and GetForwardedTypes reports the expected loader exception behavior.

Actual behavior

Examples:

CustomAttributeTests.TestMarshalAsPseudoCustomAttribute("F4")
Expected IidParameterIndex: 42
Actual: 0

F11 and F12 also report differing pseudo-attribute values.

AssemblyTests.AssemblyGetForwardedTypesLoadFailure
Assert.True() Failure
Expected: True
Actual: False

Regression?

Unknown. Broad trimmed ReadyToRun library coverage is newly enabled. Related historical Mono/EAT reflection trimming issue: #50715, but these failures are different tests and runtime configuration.

Known Workarounds

Keep System.Reflection.MetadataLoadContext.Tests.dll interpreted and temporarily exclude only AssemblyGetForwardedTypesLoadFailure under aggressively trimmed browser tests. Product reflection assemblies remain ReadyToRun compiled.

Configuration

Browser-Wasm CoreCLR Release, aggressively trimmed per-app ReadyToRun, Linux Helix host, Chrome 153.

Other information

Re-enable when the required pseudo-attribute and forwarded-type metadata survives this publish configuration.

Note

This issue was generated with GitHub Copilot assistance and reviewed as part of the #133193 bring-up.

Activity

  1. dotnet-policy-service commented on Sep 19, 2026

    @dotnet-policy-service
    Contributor

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

  2. dotnet-policy-service commented on Sep 19, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection
    See info in area-owners.md if you want to be subscribed.

  3. added this to the 12.0.0 milestone on Sep 21, 2026
  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 21, 2026
  5. added
    disabled-testThe test is disabled in source code against the issue
    on Sep 21, 2026
  6. lewing commented on Sep 27, 2026

    @lewing
    MemberAuthor

    Root causes, both reproduced locally on trimmed browser-wasm CoreCLR:

    Note

    This comment was generated with GitHub Copilot assistance.

  7. locked and limited conversation to collaborators on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions