0

Using Windows UI Library 3 Preview 2 (July 2020) that was released just yesterday. On latest version of VS2019 - Preview, followed this official tutorial Get started with WinUI 3 for desktop apps to create a desktop project. Project successfully compiles but gives the following error when running in debug mode. I'm using Windows10 Pro ver. 1903:

System.MissingMethodException
  HResult=0x80131513
  Message=Method not found: 'Void System.Runtime.InteropServices.ComWrappers.RegisterForTrackerSupport(System.Runtime.InteropServices.ComWrappers)'.
  Source=WinRT.Runtime
  StackTrace:
   at WinRT.ComWrappersSupport.set_ComWrappers(ComWrappers value)
   at WinRT.ComWrappersSupport.InitializeComWrappers(ComWrappers wrappers)
   at WinUI_DesptopPreview2.Program.Main(String[] args) in C:\DotNET5VS2019\Desktop_WinUI\WinUI_DesptopPreview2\WinUI_DesptopPreview2\obj\x64\Debug\net5.0\win-x64\App.g.i.cs:line 25

Screenshot of the error:

enter image description here

nam
  • 21,967
  • 37
  • 158
  • 332
  • 1
    You have most likely found a bug in the preview, which is not uncommon mind you, also considering its only preview 2. If you are concerned about this there are channels where you can register this problem – TheGeneral Jul 17 '20 at 04:36
  • @TheGeneral You are correct, it indeed is a bug (user `@user8961312` discovered it and found a solution, as well). Please see my comments below for details. – nam Jul 17 '20 at 15:42

1 Answers1

1

I ran into this issue as well, updating .NET 5 SDK to preview 6 solved it for me. Link to the installer: https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-preview.6-windows-x64-installer

  • Welcome to `StackOverflow` and doing an excellent job even in your very first response. Keep up the good work. Your suggestion worked (thank you). Step 3 of their official document [Install WinUI 3 Preview 2](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/#install-winui-3-preview-2) is still asking for installing `.NET 5 SDK to preview 5` that (as you also encountered) does not work for `WinUI 3.0 - Preview 2`. Can't thank you enough for saving me lots of time. – nam Jul 17 '20 at 15:39