You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
[wasm] ILLinker crash System.NotImplementedException: Var in System.Reflection.Metadata tests #2963
Rolling build with /p:EnableAggressiveTrimming=true:
ILLink : error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues [/__w/1/s/src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj]
##[error]ILLink(0,0): error IL1012: (NETCORE_ENGINEERING_TELEMETRY=Build) IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues
Fatal error in IL Linker
Unhandled exception. System.NotImplementedException: Var
at Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
at Mono.Cecil.CustomAttribute.<Resolve>b__35_0(CustomAttribute attribute, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem](TItem item, Action`2 read)
at Mono.Cecil.CustomAttribute.Resolve()
at Mono.Cecil.CustomAttribute.get_HasConstructorArguments()
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
Changes since the last rolling build: 063f7b7...4211dc4 .
The only commit with changes to SRM that I can see - b947dd6 .
commit b947dd6e1bb45b064e30159c9251add5c80914af
Author: Buyaa Namnan <bunamnan@microsoft.com>
Date: Tue Aug 9 09:09:49 2022 -0700
Generic attributes handling in CustomAttributeDecoder (#72561)
* Add handling of generic attributes to CustomAttributeDecoder
If the attribute constructor refers to the generic T in its signature, we would throw `BadImageFormatException`. This adds h
andling by capturing the generic context and interpreting the signature variables when needed.
This is a Cecil bug. Apparently, it also doesn't support generic attributes that Roslyn is introducing support for.
It will probably take a while to fix that because it's in Cecil, and that needs to propagate to the linker repo and that needs to propagate to the runtime repo.
The System.Reflection.Metadata support for generic attributes is critical for 7.0 (both for our customers and for our own tools that depend on S.R.Metadata, such as the NativeAOT compiler). @buyaa-n Once the revert is done, would it be possible to re-submit just the product change of dotnet/runtime#72561 without the test changes so that we have it in main again soon?
@buyaa-n Once the revert is done, would it be possible to re-submit just the product change of dotnet/runtime#72561 without the test changes so that we have it in main again soon?
Yes we can as tests are passed previously, also maybe create an issue and add active issue to the new tests instead of removing them
but this is breaking scheduled rolling builds on main.
@radical I am not familiar with what rolling builds does, is there a way to conditionally disable/ifdef the new tests from that build? I removing or commenting those tests is only option?
I don't know the details, but can we disable only the specific individual tests for wasm, so they are not included in the test suite at all, instead of disabling tests for the entire library?
I don't know the details, but can we disable only the specific individual tests for wasm, so they are not included in the test suite at all, instead of disabling tests for the entire library?
We would need to ifdef it out (and the corresponding test) on browser. I don't know if we can per-platform ifdef things for libraries that don't have a WASM-specific version (this all targets net7.0, not net7.0-windows/net7.0-browser, etc.). Probably not.
Right, it needs follow up work now that NativeAOT can parse these attributes. That's why it's critical for this change to get in :). I cannot do the follow up work without the S.R.Metadata change.
Activity
buyaa-n commentedon Aug 10, 2022
I guess its better to revert my PR to unblock dotnet/runtime#73410
radical commentedon Aug 10, 2022
I'm not sure about dotnet/runtime#73410 having this, but this is breaking scheduled rolling builds on
main.MichalStrehovsky commentedon Aug 10, 2022
This is a Cecil bug. Apparently, it also doesn't support generic attributes that Roslyn is introducing support for.
It will probably take a while to fix that because it's in Cecil, and that needs to propagate to the linker repo and that needs to propagate to the runtime repo.
The System.Reflection.Metadata support for generic attributes is critical for 7.0 (both for our customers and for our own tools that depend on S.R.Metadata, such as the NativeAOT compiler). @buyaa-n Once the revert is done, would it be possible to re-submit just the product change of dotnet/runtime#72561 without the test changes so that we have it in main again soon?
buyaa-n commentedon Aug 10, 2022
Yes we can as tests are passed previously, also maybe create an issue and add active issue to the new tests instead of removing them
@radical I am not familiar with what rolling builds does, is there a way to conditionally disable/ifdef the new tests from that build? I removing or commenting those tests is only option?
radical commentedon Aug 10, 2022
Rolling builds are scheduled builds that run twice a day. In this case they are running against 'main' with no other changes.
The revert should be enough for them.
MichalStrehovsky commentedon Aug 10, 2022
The problem is while building the tests, so ActiveIssue won't cut it.
We could alternatively disable building the tests on WASM (with a link to this issue) by adding S.R.Metadata tests somewhere around here:
https://github.com/dotnet/runtime/blob/a3fb0d383adf98ee2fb2ab816c28735dc1caaba0/src/libraries/tests.proj#L345-L374
Basically, I want to make sure the S.R.Metadata change ships in 7.0 irrespective of whether the illinker fix makes it. The Roslyn feature is shipping.
radical commentedon Aug 10, 2022
I don't know the details, but can we disable only the specific individual tests for wasm, so they are not included in the test suite at all, instead of disabling tests for the entire library?
buyaa-n commentedon Aug 10, 2022
Right, looked into the build log, I see that now. I will try to ifdef the generic attributes part (will run wasm build on my new PR)
@MichalStrehovsky please take a look at this log: https://dev.azure.com/dnceng/public/_build/results?buildId=1932703&view=logs&j=d9366717-4230-52c6-0a51-0b43431c29c7&t=c627612c-ea4b-5282-5e42-8a39063fd2d8. It throw
BadImageFormatExceptiononwindows x64 Release NativeAOT_Libs_PassingandLinux x64 Release NativeAOT_Libs_Passingbuilds, I suspect that is not expectedMichalStrehovsky commentedon Aug 10, 2022
illinker chokes as soon as it sees this:
https://github.com/dotnet/runtime/blob/a3fb0d383adf98ee2fb2ab816c28735dc1caaba0/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs#L302-L310
We would need to ifdef it out (and the corresponding test) on browser. I don't know if we can per-platform ifdef things for libraries that don't have a WASM-specific version (this all targets net7.0, not net7.0-windows/net7.0-browser, etc.). Probably not.
MichalStrehovsky commentedon Aug 10, 2022
Right, it needs follow up work now that NativeAOT can parse these attributes. That's why it's critical for this change to get in :). I cannot do the follow up work without the S.R.Metadata change.
radical commentedon Aug 10, 2022
This is just a test though. We can ifdef tests.
radical commentedon Aug 10, 2022
The change was reverted, and we no longer have the crash. Closing this.
MichalStrehovsky commentedon Aug 10, 2022
Is there an issue tracking the Cecil bug?
radical commentedon Aug 10, 2022
Not that I know of.
MichalStrehovsky commentedon Aug 10, 2022
Reopening then and throwing it over the fence to the linker repo.