how to disable AOT in Maui

Eduard Kaufmann 311 Reputation points
2025-03-01T08:09:23.1033333+00:00

how to disable AOT in Maui

My MauiApp runs ONLY in 'debug' mode!

According to the .net, VS, Maui community I found many recommendations to disable AOT.

Although, I never got an error msg to this direction!

In .csproj I tested with 'all' combinations of:

<PropertyGroup>

<RunAOTCompilation>False</RunAOTCompilation>		

<EnableAOTCompilation>False</EnableAOTCompilation>

<AotAssemblies>False</AotAssemblies>
```</PropertyGroup>

environment: VS 17.13.2, W11, tested with net8.0 and net9.0  
updated to latest NuGet packages

... the App starts, but then returns (stops) without any error msg!

APP:       https://github.com/edikaufmann/RandoJson

Your help is appreciated, ed
Developer technologies .NET .NET MAUI
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2025-03-04T02:41:49.64+00:00

    Hello,

    I have downloaded your project and tested it in release mode on Windows and Android without any changes. I also tested updating the Nuget Package to 9.0.40. They all work as expected.

    Therefore, this is not an issue with the AOT compiler. You could repair or update Visual Studio to the latest version and then run this project for testing. In my test environment, I used Version 17.13.0 Preview 1.0.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2025-03-01T16:42:29.34+00:00

    You don’t specify with mobile o/s and hardware you are having trouble with. It could also be a result of trimming, or a timing bug.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.