Skip to content

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

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

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

    arch-wasmWebAssembly architecturearea-System.Reflectionos-browserBrowser variant of arch-wasmuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions