dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.97k stars 4.65k forks source link

Assertion: `mono/mini/aot-runtime.c:2459`, condition 'is_ok (error)' not met (AOT) #106986

Open anasonov1992 opened 10 months ago

anasonov1992 commented 10 months ago

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

VS 2022 17.6.6, .NET 7.0.310, .NET 8.0.100-rc.2.23502.2

Description

Hi!

I am using the following AOT properties in my .NET Android project file - ILive.Droid.csproj:

Screenshot 2023-11-09 at 17 50 23

When I run my project in Release mode I am getting crash and the following error:

*[com.ILive.Droi] Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:2459, condition `is_ok (error)' not met, function:decode_cached_class_info, Image out of date: ILive.Droid.dll.so**

where ILive.Droid.dll.so is precompiled library file for my runnable .NET Android project.

What could be the reason of that crash? How can I handle it?

Before migration my project from Xamarin to .NET 7 the deprecated now property $(AotAssemblies) worked fine.

Steps to Reproduce

  1. Set AOT properties for a .NET Android project to:

Screenshot 2023-11-09 at 17 50 23

  1. Run the project in Release mode.
  2. Get an error

[com.ILive.Droi] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:2459, condition `is_ok (error)' not met, function:decode_cached_class_info, Image out of date: ILive.Droid.dll.so

where ILive.Droid.dll.so is precompiled library file for my runnable .NET Android project.

Did you find any workaround?

No workaround.

Relevant log output

[com.ILive.Droi] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:2459, condition `is_ok (error)' not met, function:decode_cached_class_info, Image out of date: ILive.Droid.dll.so
anasonov1992 commented 10 months ago

@grendello @jonathanpeppers I tried to run the app on .NET 7.0.403 SDK in Release in AOT mode with custom AOT profile set and got a different error on startup:

[com.ILive.Droi] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:3699, condition `is_ok (error)' not met, function:decode_patch, module 'MvvmCross.dll.so' is unusable (GUID of dependent assembly Xamarin.AndroidX.AppCompat doesn't match (expected 'D2BB1957-452C-4259-A4E1-2283CDC85A00', got '371EE7DB-540F-4AEC-A68F-E0AEF05DCF20')). [libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7540 (com.ILive.Droid), pid 7540 (com.ILive.Droid)

Previously I produced custom AOT profile by Mono.AotProfiler.Android as described here: https://github.com/jonathanpeppers/Mono.Profiler.Android#usage-of-the-aot-profiler

I found such error case in the following issue with milestone ".NET 8 Planning" https://github.com/dotnet/maui/issues/8928

So to test AOT mode on .NET 8 I tried to run the app on available .NET 8.0.100-rc.2.23502.2 SDK but got the same error.

jonathanpeppers commented 10 months ago

@anasonov1992 is there an MvvmCross project template we could try? Maybe it has the same issue?

anasonov1992 commented 10 months ago

@anasonov1992 is there an MvvmCross project template we could try? Maybe it has the same issue?

@jonathanpeppers we cannot provide you with the code from our solution, but I will try to create a template in which the problem will be reproducible.

Flash3001 commented 7 months ago

@anasonov1992 did you find a workaround for this? I am facing the same issue.

RobTF commented 6 months ago

Same issue here.

03-07 10:07:50.871 19114 19114 E <REDACTED>: * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:2531, condition 'is_ok (error)' not met, function:decode_cached_class_info, Image out of date: <REDACTED>.dll.so

EvgenyMuryshkin commented 4 months ago

Still an issue in 17.9.6 and 17.10.0 Preview 7.

MAUI project, certain versions of various packages seem to be working together But once any of them is upgraded, then the release build does not run.

Default project settings, nothing specific configured.