Skip to content

ILC throws an IndexOutOfRangeException #126967

@filipnavara

Description

@filipnavara

Issue #123833 noted an error in the ILC compiler that was fixed in PR #123911.

We are hitting the same problem in .NET 10 (also using the WeCantSpell.Hunspell library, just on macOS):

Error: Index was outside the bounds of the array.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x5fd4
   at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x4c98
   at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x4c98
   at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x4c98
   at ILCompiler.TypePreinit.ScanType(CompilationModuleGroup, ILProvider, TypePreinit.TypePreinitializationPolicy, ReadOnlyFieldPolicy, FlowAnnotations, MetadataType) + 0xf8
   at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x24
   at ILCompiler.PreinitializationManager.IsPreinitialized(MetadataType) + 0x8c
   at ILCompiler.DependencyAnalysis.GCStaticsNode..ctor(MetadataType, PreinitializationManager) + 0x40
   at ILCompiler.DependencyAnalysis.NodeFactory.<CreateNodeCaches>b__47_2(MetadataType) + 0x98
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey, Func`2) + 0xac
   at ILCompiler.DependencyAnalysis.ReadyToRunHelperNode.EmitCode(NodeFactory, X64Emitter&, Boolean) + 0x1320
   at ILCompiler.DependencyAnalysis.AssemblyStubNode.GetData(NodeFactory, Boolean) + 0x3dc
   at ILCompiler.DependencyAnalysis.ObjectNode.GetStaticDependencies(NodeFactory) + 0x48
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0x50
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xf4
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x4c
   at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x594
   at ILCompiler.Program.<Run>g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x16c
   at ILCompiler.Program.Run() + 0x25c4
   at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass261_0.<.ctor>b__0(ParseResult) + 0x2f8

Perhaps the fix should be backported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    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