Skip to content

Preserve Hot Reload deletion-marker forwarder in trimmed Loader tests - #136927

Open
radekdoulik wants to merge 1 commit into
dotnet:mainfrom
radekdoulik:radekdoulik-wasm-r2r-library-failure
Open

radekdoulik wants to merge 1 commit into
dotnet:mainfrom
radekdoulik:radekdoulik-wasm-r2r-library-failure

Conversation

@radekdoulik

Copy link
Copy Markdown
Member

Summary

Preserve the MetadataUpdateDeletedAttribute forwarder in the Loader tests' existing linker descriptor.

DeleteMemberTest applies a metadata delta that references the attribute through System.Runtime.Loader. Aggressive trimming removes that facade's forwarder, although the attribute definition remains in CoreLib. Reflection then throws TypeLoadException when filtering deleted members. The single-type root preserves the missing forwarding metadata without disabling trimming, changing R2R mode, copying whole assemblies, or skipping tests.

This addresses the managed test failure after successful full-library R2R publishing in build 1661603. It is separate from the already-merged build-serialization repair.

Validation

Reused the existing macOS/arm64-hosted browser/CoreCLR Release baseline. The commands below omit only the diagnostic /bl: output-file paths.

export PATH="/opt/homebrew/bin:$PATH"
export DOTNET_WASM_TOOL_CACHE_DIR="$PWD/.dotnet/wasm-tools"
unset EMSDK_PATH WASI_SDK_PATH

Focused regression command, run before and after the descriptor change:

XHARNESS_COMMAND=test-browser ./dotnet.sh build /t:Test \
  src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj \
  /p:TargetOS=browser /p:TargetArchitecture=wasm \
  /p:RuntimeFlavor=CoreCLR /p:Configuration=Release \
  /p:TestWasmReadyToRun=true /p:EnableAggressiveTrimming=true \
  /p:TestScope=all /p:Scenario=WasmTestOnChrome /p:InstallChromeForTests=true \
  /p:XunitMethodName=System.Reflection.Metadata.ApplyUpdateTest.DeleteMemberTest \
  /maxcpucount:1
  • Before: expected failure, exit 1; 1 executed, 1 failed, 0 skipped, with the exact CI exception.
  • After: passed, exit 0; 1 executed, 1 passed, 0 skipped.

Complete CI-selected Loader suite:

XHARNESS_COMMAND=test-browser ./dotnet.sh build /t:Test \
  src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj \
  /p:TargetOS=browser /p:TargetArchitecture=wasm \
  /p:RuntimeFlavor=CoreCLR /p:Configuration=Release \
  /p:TestWasmReadyToRun=true /p:EnableAggressiveTrimming=true \
  /p:TestScope=all /p:Scenario=WasmTestOnChrome /p:InstallChromeForTests=true \
  /p:WithoutCategories=IgnoreForCI /maxcpucount:1

Passed, exit 0: 71 total, 49 passed, 0 failed, 22 skipped. This uses the existing CI category exclusions, with no method/class filter. XML comparison confirms the same 71 test names and 22 skipped identities as the CI result; only DeleteMemberTest changes from Fail to Pass. Both successful builds report 0 warnings/errors.

Metadata inspection confirms the marker forwarder is missing from the original published WebCIL facade and present after the fix. The fixture and delta remain byte-identical; the published CoreLib asset matches the R2R compiler output.

No patched Linux CI, full-library, Mono, or mobile run was performed. No runtime or public API code is changed.

Note

This PR was prepared with GitHub Copilot.

Root the delta-only MetadataUpdateDeletedAttribute reference through System.Runtime.Loader so aggressive trimming preserves its type forwarder.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Nov 3, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

<assembly fullname="ReferencedClassLib" />
<assembly fullname="ReferencedClassLibNeutralIsSatellite" />
<assembly fullname="System.Runtime.Loader">
<!-- Keep the forwarder referenced only by hot reload deltas. -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the problem that we are running the trimmer on hot reload deltas?

I do not think it makes sense - trimming and hot reload don't mix.

This branch has not been deployed

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

Labels

area-Infrastructure-libraries linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants