I use the latest verison of Visual Studio (17.14.16). I create a new MAUI project targeting .NET9 and using NuGet manager I add "TMS.FlexCel" version 7.25 (previously I had 7.23 and had the same issues). If I compile for Android in debug mode it works. If I switch to Release mode it fails with the below two errors:
Precompiling failed for C:\Users\mariusrusu\Desktop\MauiApp1\obj\Release\net9.0-android\android-arm64\linked\System.Private.Windows.Core.dll with exit code -1073741819.
Mono Ahead of Time compiler - compiling assembly C:\Users\mariusrusu\Desktop\MauiApp1\obj\Release\net9.0-android\android-arm64\linked\System.Private.Windows.Core.dll
AOTID 9471C855-6C71-E4FA-FA68-DAE0D68D7E0D
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui.aotprofile'
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui-sc.aotprofile'
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui-blazor.aotprofile'
Added 0 methods from profile.
Added 0 methods from profile.
Added 0 methods from profile.
Could not load signature of System.Windows.Forms.Nrbf.SerializationRecordExtensions+TryGetDelegate:BeginInvoke due to: Could not load file or assembly 'System.Formats.Nrbf, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
Precompiling failed for C:\Users\mariusrusu\Desktop\MauiApp1\obj\Release\net9.0-android\android-x64\linked\System.Private.Windows.Core.dll with exit code -1073741819.
Mono Ahead of Time compiler - compiling assembly C:\Users\mariusrusu\Desktop\MauiApp1\obj\Release\net9.0-android\android-x64\linked\System.Private.Windows.Core.dll
AOTID 828205EA-53D2-4491-853A-D30FBD223221
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui.aotprofile'
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui-sc.aotprofile'
Using profile data file 'C:\Users\mariusrusu.nuget\packages\microsoft.maui.controls.build.tasks\9.0.82\buildTransitive\netstandard2.0\maui-blazor.aotprofile'
Added 0 methods from profile.
Added 0 methods from profile.
Added 0 methods from profile.
Could not load signature of System.Windows.Forms.Nrbf.SerializationRecordExtensions+TryGetDelegate:BeginInvoke due to: Could not load file or assembly 'System.Formats.Nrbf, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
If I add the below code to my csproj file, it compiles succesfully in Release mode:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-android|AnyCPU'">
<RunAOTCompilation>false</RunAOTCompilation>
</PropertyGroup>
What should I do/try?
Thanks