5

I'm using Maui preview (now release candidate) with a blazorwebview, to build a fairly simple app which connects to a webservice and synchronises data.

The windows and Android versions flew by. The iOS version has been a long slog. After upgrading my Mac (and a long list of workarounds) I was finally able to get some builds to deploy via testflight.

In the iOS version emulator works fine, but on a real device its throwing up a weird error parsing JSON (when doing a deserialise - I'm using newtonsoft) "error setting value to MyProp on MyObject" (names changed).

After much faffing, I got it debugging on a device and it worked fine. So that drew me to the conclusion that it must be a release optimization issue (it wasn't loading all my classes so deserialise fails).

However, no matter what linker settings I changed in the csproj file (full, sdkonly etc) the release build doesn't work. I could see the package size going up and down with these changes so they were obviously working. I've now deployed the debug version via testflight and it's working fine.

In my mind if the linker settings are the same then debug Vs release builds should be the same, but there is obviously a difference.

The release version of the package always seems to be double the size of debug (which is replicated with the different linker settings, ie sdkonly release is double sdkonly debug), so it looks like it's storing two builds in the release package?

Also when building in release mode it takes about 15minutes to build and in debug about 3.. so there must be significant difference I'm missing. Can anyone explain?

Jim
  • 479
  • 2
  • 8
  • Release versions store package, publisher... data. I guess that is why it is bigger. As for the "unable to run release versions" problem I would make sure it is not something iOS-permissions related. Maybe try it on another device? – Josep Enric Sendra Serra Aug 30 '22 at 11:36
  • Thanks for taking the time to comment @JosepEnricSendraSerra - tried many devices... In the end I managed to get my app to deploy as multi-device deployment built in Debug mode (with lots of linking turned off).. I suspect the linker is doing different (undocumented) things in release mode. – Jim Oct 04 '22 at 12:11
  • During compilation of a MAUI application in release mode, in Visual Studio output window, you can see the message "Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing.". The message refers the page "https://aka.ms/dotnet-illink", that explains some problems with trimming. See also: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/incompatibilities?source=recommendations. Hope this helps. – rentoulis Apr 28 '23 at 14:51

0 Answers0