Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] ILLinker throws InvalidOperationException #70031

Closed
radical opened this issue May 31, 2022 · 2 comments
Closed

[wasm] ILLinker throws InvalidOperationException #70031

radical opened this issue May 31, 2022 · 2 comments
Labels
arch-wasm WebAssembly architecture area-VM-reflection-mono Reflection issues specific to MonoVM blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' linkable-framework Issues associated with delivering a linker friendly framework

Comments

@radical
Copy link
Member

radical commented May 31, 2022

Build:

  oob -> Trimming browser-wasm out-of-band assemblies with ILLinker...
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/oob.proj]
##[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.InvalidOperationException: Operation is not valid due to the current state of the object.
     at Mono.Linker.Dataflow.DiagnosticUtilities.GetMethodParameterFromIndex(MethodDefinition method, Int32 parameterIndex)
     at ILLink.Shared.TrimAnalysis.FlowAnnotations.ValidateMethodAnnotationsAreSame(MethodDefinition method, MethodDefinition baseMethod)
     at Mono.Linker.Steps.ValidateVirtualMethodAnnotationsStep.Process()
     at Mono.Linker.Steps.BaseStep.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, Boolean throwOnFatalLinkerException)
     at Mono.Linker.Driver.Main(String[] args)
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(287,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetField(String, BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(287,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetField(String, BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.

Wasm has two builds relevant here:

  1. EAT (EnableAggressiveTrimming);
  2. and AOT (this is EAT build, and then AOT'ed)

Here the EAT is passing, but AOT fails. So, this doesn't seem to happen on every build.

EAT (EnableAggressiveTrimming) build - which passed.

@eerhardt @vitek-karas

@radical radical added arch-wasm WebAssembly architecture blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' linkable-framework Issues associated with delivering a linker friendly framework labels May 31, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label May 31, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Reflection and removed untriaged New issue has not been triaged by the area owner labels May 31, 2022
@ghost
Copy link

ghost commented May 31, 2022

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr
See info in area-owners.md if you want to be subscribed.

Issue Details

Build:

  oob -> Trimming browser-wasm out-of-band assemblies with ILLinker...
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/oob.proj]
##[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.InvalidOperationException: Operation is not valid due to the current state of the object.
     at Mono.Linker.Dataflow.DiagnosticUtilities.GetMethodParameterFromIndex(MethodDefinition method, Int32 parameterIndex)
     at ILLink.Shared.TrimAnalysis.FlowAnnotations.ValidateMethodAnnotationsAreSame(MethodDefinition method, MethodDefinition baseMethod)
     at Mono.Linker.Steps.ValidateVirtualMethodAnnotationsStep.Process()
     at Mono.Linker.Steps.BaseStep.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, Boolean throwOnFatalLinkerException)
     at Mono.Linker.Driver.Main(String[] args)
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(245,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetConstructors(BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetConstructors(BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.
/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(287,13): Trim analysis error IL2094: System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetField(String, BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage. [/__w/1/s/src/libraries/oob.proj]
##[error]/_/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.Mono.cs(287,13): error IL2094: (NETCORE_ENGINEERING_TELEMETRY=Build) System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags): 'DynamicallyAccessedMemberTypes' in 'DynamicallyAccessedMembersAttribute' on the implicit 'this' parameter of method 'System.Reflection.Emit.EnumBuilder.GetField(String, BindingFlags)' don't match overridden implicit 'this' parameter of method 'System.Type.GetField(String, BindingFlags)'. All overridden members must have the same 'DynamicallyAccessedMembersAttribute' usage.

Wasm has two builds relevant here:

  1. EAT (EnableAggressiveTrimming);
  2. and AOT (this is EAT build, and then AOT'ed)

Here the EAT is passing, but AOT fails. So, this doesn't seem to happen on every build.

EAT (EnableAggressiveTrimming) build - which passed.

@eerhardt @vitek-karas

Author: radical
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, linkable-framework

Milestone: -

@agocke
Copy link
Member

agocke commented Jun 6, 2022

Closing as dup of #69536

@agocke agocke closed this as completed Jun 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-reflection-mono Reflection issues specific to MonoVM blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

No branches or pull requests

3 participants