Repository navigation
Commit 29be631
[browser][CoreCLR] Root UnloadableAssembly so trimmed builds keep it for AssemblyGetForwardedTypesLoadFailure (#134759)
This fixes the forwarded-types half of #134263 and re-enables
`AssemblyGetForwardedTypesLoadFailure` on browser aggressive-trimming
builds.
**Cause:** `ForwardedTypesAssembly` contains `[assembly:
TypeForwardedTo(typeof(TypeInUnloadableAssembly))]`.
`UnloadableAssembly` has `[assembly: ReferenceAssembly]`, and that
attribute is why loading it throws the `BadImageFormatException` the
test expects. The type forwarder is the only reference to
`UnloadableAssembly`, so ILLink removed `UnloadableAssembly.dll` from
the trimmed output and shipped only its `.pdb`. `GetForwardedTypes` then
fails because the file is missing, not with `BadImageFormatException`,
so `foundBifException` is false.
**Fix:** Root `UnloadableAssembly` in the test's
`ILLink.Descriptors.xml`. The assembly is then kept along with its
`ReferenceAssemblyAttribute`. This PR also removes the `ActiveIssue` for
#134263 on the test.
**Apple CoreCLR:** This PR also removes the Apple mobile CoreCLR
`ActiveIssue` for #124344, which #129226 added because
`GetForwardedTypes()` failed on trimmed Apple CoreCLR app bundles. The
cause is likely the same: Apple CoreCLR lanes build with
`EnableAggressiveTrimming=true`, and the descriptor applies on all
platforms. This still needs validation in runtime-extra-platforms
(ioslikesimulator).
**Android:** The Android `ActiveIssue` for #77821 stays. Android lanes
aren't trimmed today, and #77821 predates CoreCLR on Android.
**Validation:** browser-wasm, CoreCLR, Release.
- Before the fix, the failure reproduced with
`EnableAggressiveTrimming=true TestTrimming=true` (no R2R).
- After the fix, the full System.Reflection.Tests suite ran in the CI
lane configuration (`EnableAggressiveTrimming=true
TestWasmReadyToRun=true`, Chrome): 1773 tests, 1749 passed, 24 skipped,
0 failed. `AssemblyGetForwardedTypesLoadFailure` was among the passing
tests.
**Scope:** This PR does **not** resolve #134263. The MetadataLoadContext
MarshalAs half is a Cecil bug. When ILLink rewrites assemblies, it drops
the IidParameterIndex for IDispatch/IUnknown/Interface and the SafeArray
user-defined subtype from FieldMarshal blobs (confirmed byte-for-byte).
That needs a fix in dotnet/cecil, so the existing `TrimMode=copy`
workaround in `System.Reflection.MetadataLoadContext.Tests.csproj`
stays.
Contributes to #134263
> [!NOTE]
> This PR was generated with GitHub Copilot assistance.
---------
Co-authored-by: Copilot App <[email protected]>1 parent 58e2ee1 commit 29be631
2 files changed
Lines changed: 2 additions & 3 deletions
File tree
- src/libraries/System.Runtime/tests/System.Reflection.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
958 | 958 | | |
959 | 959 | | |
960 | 960 | | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | 961 | | |
965 | 962 | | |
966 | 963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
0 commit comments