2

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.

tribal
  • 219
  • 3
  • 14
  • checked this? https://support.microsoft.com/en-au/topic/-loading-this-assembly-would-produce-a-different-grant-set-from-other-instances-error-message-when-you-run-a-net-framework-2-0-based-application-on-a-computer-that-is-running-a-64-bit-version-of-windows-b4c26f24-78a8-d56b-c9cb-9e2da5f5aea4 – Rafael Jun 25 '23 at 12:39
  • @Rafael, that is about a hotfix to a 13-year-old version of .net framework. Not related to this. – ToolmakerSteve Jun 25 '23 at 17:38
  • @Rafael, Steve is right, its not relevant. Only the error message is the same.I am building an Android mobile app. – tribal Jun 25 '23 at 18:24
  • 1
    @tribal I would start to remove xaml files from the project and check, when this error is gone, to determine what xaml file produces this error. Then in this xaml file I would start to removing (commenting) blocks to determine what block causes this error. – Rafael Jun 25 '23 at 18:56
  • You can accept your own answer if it's helpful to others facing the same problem. – Jianwei Sun - MSFT Jun 26 '23 at 02:21

1 Answers1

0

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.

tribal
  • 219
  • 3
  • 14