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

Fatal error in IL Linker #3184

Closed
arivoir opened this issue Dec 24, 2022 · 3 comments
Closed

Fatal error in IL Linker #3184

arivoir opened this issue Dec 24, 2022 · 3 comments

Comments

@arivoir
Copy link

arivoir commented Dec 24, 2022

Description

When building a net7 Android application in Release mode I get 4 errors all similar saying

Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

Steps to Reproduce

Create Android native project targeting net7
Build it in Release configuration

Link to public reproduction project repository

No demo

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.4.2

Did you find any workaround?

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
	<RunAOTCompilation>False</RunAOTCompilation>
	<PublishTrimmed>False</PublishTrimmed>
</PropertyGroup>

Relevant log output

1>Fatal error in IL Linker
1>Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
1>   at Mono.Linker.Steps.MarkStep.IsMethodNeededByInstantiatedTypeDueToPreservedScope(MethodDefinition method)
1>   at Mono.Linker.Steps.MarkStep.GetRequiredMethodsForInstantiatedType(TypeDefinition type)+MoveNext()
1>   at Mono.Linker.Steps.MarkStep.MarkRequirementsForInstantiatedTypes(TypeDefinition type)
1>   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
1>   at Mono.Linker.Steps.MarkStep.ProcessQueue()
1>   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1>   at Mono.Linker.Steps.MarkStep.Process()
1>   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Main(String[] args)
@mattleibow
Copy link
Member

@jonathanpeppers thoughts?

@mattleibow mattleibow transferred this issue from dotnet/maui Jan 13, 2023
@jonathanpeppers
Copy link
Member

I think we just move this to dotnet/linker, this is where the method above is:

bool IsMethodNeededByTypeDueToPreservedScope (MethodDefinition method)

@marek-safar
Copy link
Contributor

Duplicate of #3112

@marek-safar marek-safar marked this as a duplicate of #3112 Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants