Align System.Reflection.Metadata CustomAttributeDecoder tests with resource-embedded assembly scheme
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
## Description
System.Reflection.Metadata.Tests uses two schemes for exercising its APIs. Most tests embed the assemblies under test as resources and read their metadata through TestResources
https://github.com/dotnet/runtime/blob/f942875639cf93fce159b0c1f66aba59b8b2d942/src/libraries/System.Reflection.Metadata/tests/Resources/TestResources.cs#L19-L28
CustomAttributeDecoderTests instead introspects the running test assembly, which does not work under
single-file, trimming, or NativeAOT, and is sensitive to how the host resolves BCL type references (e.g. System.Runtime vs. System.Private.CoreLib). As a result the tests are guarded with ConditionalFact(NotSingleFile) and workarounds for assembly-identity differences.
## Proposal
Convert CustomAttributeDecoderTests to the embedded-resource scheme used by the rest of the suite. Add a helper assembly containing the types and custom attributes the decoder needs to examine, embed it as a resource, and load its metadata through TestResources. Drop ConditionalFact(NotSingleFile) and the assembly-identity workarounds, since the tests would assert against fixed metadata in the embedded resource. This aligns the tests with the rest of System.Reflection.Metadata.Tests and makes them runnable under single-file, trimming, and NativeAOT.
Contributor guide
Assessment
This issue has not been assessed yet.