Skip to content

Android AOT+LLVM InvalidOperation_EnumEnded #73304

@jonathanpeppers

Description

@jonathanpeppers

Description

In a PR where we have $(EnableLLVM) working on Android in .NET 7: dotnet/android#7188

Some of our unit tests fail with:

System.InvalidOperationException : InvalidOperation_EnumEnded
at System.ArrayEnumerator.get_Current()
at Cadenza.Collections.Tests.CollectionContract`1[[System.Int16, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].DisposeCollection(IEnumerable c)
at Cadenza.Collections.Tests.CollectionContract`1[[System.Int16, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CopyTo()
at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )

I think it's just the result of foreach over an array twice?

Reproduction Steps

Build my branch on dotnet/android#7188 in Release mode, I will try to merge it with tests disabled to make this easier.

Then run the test:

./dotnet-local.sh build tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj -t:Install,RunTestApks -c Release

I can also share the .apk file if that helps.

Expected behavior

We shouldn't get InvalidOperation_EnumEnded.

Actual behavior

We get InvalidOperation_EnumEnded.

Regression?

These tests are working in .NET 6.

Known Workarounds

Don't use -p:EnableLLVM=true.

Configuration

.NET 7.0.100-rc.1.22374.1 SDK

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions