microsoft/WinUI-3-Demos

Application crashes with System.MissingMethodException

RobertOwenJack opened this issue · 2 comments

I have tried .NET 5 Preview 5 and Preview 7) I am using Visual Studio 16.7 Preview 5 and having the following problem with the DemobuildCs application.
I keep getting the exception:-
System.MissingMethodException: 'Method not found: 'Void System.Runtime.InteropServices.ComWrappers.RegisterAsGlobalInstance()'.'

I saw that there might be a problem with Preview 7 which is why I downgraded to Preview 5 but still have the same problem.

same :/ did you find anything?

I got the same issue too (Version 16.7.0 Preview 6.0 / .NET 5 Preview 5 / WinUI 3 Preview 2) .
The steps below resolved the issue for me:

Open the Project properties (DemoBuildCs.csproj)

Replace this line:
<PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview1.200515.3" />
with:
<PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview2.200713.0" />

Reopen solution, rebuild and deploy.