Skip to content

ILC throws an IndexOutOfRangeException #123833

@ramezgerges

Description

@ramezgerges

Description

I'm running into an ILC exception whenever I try to compile a project for Android when referencing the WeCantSpell.Hunspell package. I attempted to copy the source files from that repo over instead of the package reference and the same exception happened.

Reproduction Steps

Repro:

  1. Clone https://github.com/unoplatform/uno. master should be fine, but at the time of writing, f6b0f49064797ffebbde8ea78a2d913de381a051 was reproducing the problem.
  2. Add a reference to WeCantSpell.Hunspell in Uno.UI.Skia.csproj here.
  3. Compile the SamplesApp.Skia.netcodemobile project
dotnet publish src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj -c Release -r android-x64 -f net10.0-android -p:UnoTargetFrameworkOverride=net10.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=3.119.2-preview.1 /bl
  1. watch it fail with the ILC exception above.

Expected behavior

Successful build

Actual behavior

EXEC : error : Index was outside the bounds of the array. [/agent/_work/1/s/src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj::TargetFramework=net10.0-android]
  System.IndexOutOfRangeException: Index was outside the bounds of the array.
     at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x6de0
     at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x5801
     at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x5801
     at ILCompiler.TypePreinit.TryScanMethod(MethodIL, TypePreinit.Value[], Stack`1, Int32&, TypePreinit.Value&) + 0x5801
     at ILCompiler.TypePreinit.ScanType(CompilationModuleGroup, ILProvider, TypePreinit.TypePreinitializationPolicy, ReadOnlyFieldPolicy, FlowAnnotations, MetadataType) + 0x10c
     at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x14
     at ILCompiler.PreinitializationManager.IsPreinitialized(MetadataType) + 0x79
     at ILCompiler.PreinitializationManager.HasLazyStaticConstructor(TypeDesc) + 0x5d
     at ILCompiler.DependencyAnalysis.ReflectedFieldNode.GetStaticDependencies(NodeFactory) + 0x26f
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0x3c
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xf1
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x4d
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x55f
     at ILCompiler.Program.<Run>g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x19c
     at ILCompiler.Program.Run() + 0x2c3d
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass261_0.<.ctor>b__0(ParseResult) + 0x31a
/home/AzDevOps/.nuget/packages/microsoft.dotnet.ilcompiler/10.0.1/build/Microsoft.NETCore.Native.targets(330,5): error MSB3073: The command ""/home/AzDevOps/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/10.0.1/tools/ilc" @"obj/Release/net10.0-android/android-x64/native/SamplesApp.ilc.rsp"" exited with code 1. [/agent/_work/1/s/src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj::TargetFramework=net10.0-android]

This is grabbed from a CI run, see the full run for more details. If the link is dead at the time you're reading this, here's the raw log.
log.txt

Regression?

No response

Known Workarounds

No response

Configuration

This reproduces on .NET SDK 10.0.102 on x64 machines when compiling for RID=android-x64 (but might also reproduce in other setups).
This reproduces on Ubuntu images from Azure pipelines and on my Windows 11 machine (26200.7623).

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions