Skip to content

ilc fails with "An item with the same key has already been added. Key: [S.P.CoreLib]System.AppContext.OnFirstChanceException(object)" #110608

@rolfbjarne

Description

@rolfbjarne

Description

NativeAOT fails with:

Error: An item with the same key has already been added. Key: [S.P.CoreLib]System.AppContext.OnFirstChanceException(object)
System.ArgumentException: An item with the same key has already been added. Key: [S.P.CoreLib]System.AppContext.OnFirstChanceException(object)
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey, TValue, InsertionBehavior) + 0x310
   at ILCompiler.UnmanagedEntryPointsRootProvider.AddCompilationRoots(IRootingServiceProvider) + 0x1a0
   at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1, NodeFactory, IEnumerable`1, ILProvider, DebugInformationProvider, IInliningPolicy, Logger) + 0x138
   at ILCompiler.RyuJitCompilationBuilder.ToCompilation() + 0x4a4
   at ILCompiler.Program.Run() + 0x2638
   at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass249_0.<.ctor>b__0(ParseResult) + 0x308

Reproduction Steps

Repro created by passing --make-repro-path ... to ilc:

114180444_MySimpleApp.zip

Expected behavior

ILC should either succeed, or display an actionable error message.

Actual behavior

See above.

Regression?

Yes, this started happening in this maestro bump: dotnet/macios#21570

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions