I'm encountering a crash in my .NET 6 MAUI application running on iOS. This issue only appears in the release build; the debug build works without issues. The crash seems to occur randomly, and I've symbolicated the crash reports to identify potential causes.
Here are the details from the crash report:
- Crash when accessing
mono_aot_Microsoft_Maui_Controls_eh_frame + 369012 - Crash at
Microsoft_iOS_UIKit_UINavigationItem_get_RightBarButtonItems (UINavigationItem.g.cs:1087)
And here's the output from atos symbolication:
mono_aot_Microsoft_Maui_Controls_eh_frame (in ixxX) + 369012Microsoft_iOS_UIKit_UINavigationItem_get_RightBarButtonItems (in ixxX) (UINavigationItem.g.cs:1087)
Environment:
- .NET MAUI version: 6
- Xamarin.Forms version: [if applicable]
- iOS version: 16.6.1
- Device: iPhone 11
- Build configuration: Release
- Development environment: Visual Studio for Mac 17.6.6
Pakcages we use:
- BouncyCastle.NetCore (1.9.0)
- CsvHelper (30.0.1)
- Microsoft.Extensions.Hosting.Abstractions (7.0.0)
- MudBlazor (6.9.0)
- Portable.BouncyCastle (1.9.0)
- sqlite-net-pcl (1.8.116)
- SQLiteNetExtensions (2.1.0)
- SQLiteNetExtensions.Async (2.1.0)
- SQLitePCLRaw.bundle_green (2.1.6)
- SQLitePCLRaw.provider.dynamic_cdecl (2.1.6)
My questions are as follows:
- What could be causing a crash in the
mono_aotportion of a .NET 6 MAUI app, specifically in release builds? - Is the
UINavigationItem's right bar button items crash a known issue in .NET 6 MAUI apps on iOS, and what are potential workarounds?
To diagnose or resolve the issue, I've:
- Cleaned and rebuilt the project multiple times.
- Reviewed the Xamarin.Forms and .NET MAUI repositories for similar issues. I've noticed others experiencing problems with release builds, where setting the interpreter to
trueis often suggested as a workaround, but this has not resolved my issue. - Confirmed that the issue is specific to the release build and is not present in the debug build.
Similar problems: https://github.com/dotnet/maui/issues/11266 https://github.com/dotnet/maui/issues/13019