Skip to content

Runtime critical type System.Diagnostics.MonoStackFrame: during AOT #11241

Closed

Description

@aguerrieri82

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11.0.100-preview.3.26207.106, VS Insiders [11723.189]

Description

Build fails when AOT is enabled and target .net 11 preview 3

Steps to Reproduce

  1. File -> New Project -> Android Application
  2. Target .NET 11
  3. Enable AOT
    <RunAOTCompilation>True</RunAOTCompilation>
    <AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
  1. Build

Did you find any workaround?

No response

Relevant log output

1>  Optimizing assemblies for size. This process might take a while.
1>  [Mono.Android.Runtime.dll] Exec (with response file contents expanded) in C:\Users\aguer\source\repos\AndroidApp1\AndroidApp1: MONO_PATH=C:\Users\aguer\source\repos\AndroidApp1\AndroidApp1\obj\Release\net11.0-android\android-x64\R2R; MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x64\11.0.0-preview.3.26207.106\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\net11.0-android\android-x64\aot\x86_64\Mono.Android.Runtime,mtriple=x86_64-linux-android,tool-prefix=C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.99.0-preview.3.10\tools\binutils\bin\x86_64-linux-android-,outfile=obj\Release\net11.0-android\android-x64\aot\Mono.Android.Runtime.dll.so,temp-path=obj\Release\net11.0-android\android-x64\Mono.Android.Runtime.dll.tmp,ld-name=ld,ld-flags=--no-relax -s -z max-page-size=16384" "obj\Release\net11.0-android\android-x64\R2R\Mono.Android.Runtime.dll"
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.99.0-preview.3.10\targets\Microsoft.Android.Sdk.Aot.targets(123,5): error : Precompiling failed for C:\Users\aguer\source\repos\AndroidApp1\AndroidApp1\obj\Release\net11.0-android\android-x64\R2R\Mono.Android.Runtime.dll with exit code -1073740791.
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.99.0-preview.3.10\targets\Microsoft.Android.Sdk.Aot.targets(123,5): error : Runtime critical type System.Diagnostics.MonoStackFrame not found
1

Activity

  1. added
    Area: App+Library Build
    needs-triage
    on Apr 28, 2026
  2. simonrozsival commented on Apr 29, 2026

    @simonrozsival
    Member

    In .NET 11, we are switching the default runtime from Mono to CoreCLR. It appears that RunAOTCompilation enables MonoAOT even when building with CoreCLR. This configuration should error with a log message saying something like:

    MonoAOT is not compatible with the CoreCLR runtime. Remove RunAOTCompilation from your project configuration.
    
  3. added this to the .NET 11 milestone on Apr 29, 2026
  4. added
    Area: CoreCLR
    and removed
    needs-triage
    on Apr 29, 2026
  5. jonathanpeppers commented on Apr 29, 2026

    @jonathanpeppers
    Member

    Does this combination fix it?

    <UseMonoRuntime>True</UseMonoRuntime>
    <RunAOTCompilation>True</RunAOTCompilation>
    <AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
  6. locked and limited conversation to collaborators on May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildArea: CoreCLR

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions