XML Xml Serialization error in MAUI iOS

Гелимянов Данил 20 Reputation points
2024-10-31T14:22:05.5033333+00:00

Good afternoon.

We are developing a mobile application for iOS on MAUI (.net 9-0). When using the Apple development profile, our application is assembled and deployed on the device without any problems (using the IDE Rider).

But when we change the Apple profile from development to distribution, build the ipa, upload it to TestFlight - on the same device, our application crashes at the start.

In both cases, the same code is used, the same build settings are used:

<PropertyGroup Condition=" '$(Configuration)' == 'Distribution' ">
    <MtouchUseLlvm>true</MtouchUseLlvm>
    <MtouchEnableBitcode>false</MtouchEnableBitcode>
    <AotAssemblies>true</AotAssemblies>
    <MtouchLink>SdkOnly</MtouchLink>
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <DebugSymbols>false</DebugSymbols>
    <CodesignKey>Apple Distribution: company-name (team-id)</CodesignKey>
    <WarningLevel>9</WarningLevel>
    <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
    <MtouchEnableSGenConc>true</MtouchEnableSGenConc>
</PropertyGroup>

After examining the crash log generated by TestFlight, we were able to obtain the following trace stack, which led to the forced termination of the application:

System_Private_Xml_System_Xml_XmlAsyncCheckReader_MoveToNextAttribute (in app-bundle-name.iOS) + 68

System_Private_Xml_System_Xml_Schema_FacetsChecker_FacetsCompiler_CompileMinLengthFacet_System_Xml_Schema_XmlSchemaFacet (inapp-bundle-name.iOS) + 136

System_Private_Xml_System_Xml_Serialization_XmlCustomFormatter__cctor (in app-bundle-name.iOS) + 20

System_Private_Xml_System_Xml_XmlParserContext_get_Encoding (in app-bundle-name.iOS) + 16

System_Private_Xml_System_Xml_Serialization_XmlSerializer_CreateReader (in app-bundle-name.iOS) + 36

System_Private_Xml_System_Xml_Schema_XmlBaseConverter_DateOffsetToString_System_DateTimeOffset (in app-bundle-name.iOS) + 56

It looks as if something went wrong during the AOT compilation process, and the code generated based on XAML markup does not work correctly.

If anyone has any ideas on how to solve this problem - crash at the start of the application - I will be very grateful if you share them, because, to be honest, I have no ideas how to solve it

Thanks in advance for any reply

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,650 questions
Microsoft Intune iOS
Microsoft Intune iOS
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.iOS: An Apple mobile operating system.
237 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 67,251 Reputation points
    2024-11-01T01:17:38.8233333+00:00

    When you debug, you typically use the il interpreter rather than aot which limits dynamic code like reflection. you can enable the interpreter for runtime. See

    https://learn.microsoft.com/en-us/dotnet/maui/macios/interpreter?view=net-maui-8.0

    for info about not using the interpreter see:

    https://github.com/dotnet/runtime/issues/101041

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.