Search code examples
mauivisual-studio-2022apple-m1parallels

Android MAUI XamlC error : Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)


I get the above error only when trying to do a .NET MAUI release build for Android using .net7. This seems to work fine in debug mode and I am able to deploy and test it on a physical device.

I have tried to search online but there doesnt seem to be any mention of the above.

I can see the error against two of the three xaml pages in my app, and one seems fine. I am using the following libraries in my app if that makes any difference

CommunityToolkit MediaElement Fody PropertyChanged App Center Crashes, distribute, analytics QRCoder Refit

The page with the MediaElement seems fine though

Also I am running VS2022 17.6.4 using Parallels on an Apple ARM. Any ideas what could be going wrong.


Solution

  • Found the issue, I was using the following declaration x:DataType=viewModels:MyViewModel in my ContentPage. This worked fine in Debug but the Release build was failing. Removing this seemed to resolve the problem.