iOS App Crashes only in Release using ServiceStack client in .Net MAUI

Good morning,
I have already read other answers for my same problem and tried to follow the directions given but I must have done something wrong because the problem seems to have worsened.
I have an assembly that contains all the templates I use for communication with servers. I have tried inserting

in the configuration file of the MAUI project but this causes the application to crash on start-up. I did not understand whether it is sufficient to enter the right TrimmerRootAssembly or whether there are also other operations to be performed.

I’ve been trying for days and don’t know what to do anymore.
Thank you very much,
Riccardo

iOS is not a supported platform, it’s No JIT restrictions on Release binaries breaks libraries that use reflection like serializers.

Best you can do is to not link or trim any assemblies that contain your serializable types, e.g. your ServiceModel .dll. Alternatively you could try enabling the interpreter in Release builds.

Something else you can try is using System.Text.Json serializer in JsonApiClient by configuring it in the client on Startup with:

ClientConfig.UseSystemJson = UseSystemJson.Always;

In which case your ServiceStack Server App should use Endpoint Routing so it’s also configured to use System.Text.Json APIs.

Otherwise you’d need to use libraries that specifically supports iOS/No JIT restrictions. If it only breaks in Release mode it’s because Maui uses an interpreter in development/debug builds.

Thanks for the advice and explanation.
Unfortunately nothing seems to work. Could you recommend libraries that support iOS/No JIT restrictions?

Thanks again

No don’t have any experience with Maui/iOS, but you’d basically need to look for Native AOT/reflection-free compatible libraries, something like source generation in System.Text.Json since it relies on code generation instead of runtime reflection.