XAML Islands for .NET Core 3.1 working in Visual Studio but not in Rider

Hi,


one of our teams currently hit a showstopper and is unable to utilize XAML islands in a .NET Core 3.1 application from within Rider.
We’re very happy with the pleasant development experience that Rider provides, and therefore somewhat at unease to need to fall back on Visual Studio for debugging.

Reproduction is easy: The solution+project available through the link below works in Visual Studio 2019 (16.5.2) but not in Jetbrains Rider (2020.1.4):

https://1drv.ms/u/s!AjIh28GZy-wj5pNPTUdymmBGEG2aEQ?e=H4yEnE 

The project itself is an as minimal WPF application as possible, only things added are:

  • Microsoft.Toolkit.Wpf.UI.Controls NuGet package.
  • XAML to show the MapControl.
  • App.Manifest.

These are the three items needed to get the UWP MapControl operational in a WPF application as can be found in the links below:

Using XAML Islands on Windows 10 19H1: fixing the "Catastrophic failure" exception
https://techcommunity.microsoft.com/t5/windows-dev-appconsult/using-xaml-islands-on-windows-10-19h1-fixing-the-quot/ba-p/376330

Host UWP XAML controls in desktop apps (XAML Islands)
https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/xaml-islands

 

In Visual studio this application shows the MapControl, however when started with Rider the exceptions below are thrown:

System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'Microsoft.Toolkit.Wpf.UI.Controls.MapControl' that matches the specified binding constraints threw an exception.' Line number '10' and line position '10'. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Toolkit.Wpf.UI.XamlHost.WindowsXamlHostBase' threw an exception. ---> System.TypeLoadException: Could not find Windows Runtime type 'Microsoft.Toolkit.Win32.UI.XamlHost.IXamlMetadataContainer'.
  at at Microsoft.Toolkit.Wpf.UI.XamlHost.WindowsXamlHostBase..cctor()
  --- End of inner exception stack trace ---
  at at Microsoft.Toolkit.Wpf.UI.XamlHost.WindowsXamlHostBase..ctor(String typeName)
  at at Microsoft.Toolkit.Wpf.UI.Controls.MapControl..ctor(String typeName)
  at at Microsoft.Toolkit.Wpf.UI.Controls.MapControl..ctor()
  --- End of inner exception stack trace ---

 

We expect the problem to be somewhat more fundamentally as the XAML islands introduce some kind of magic glue to bring WPF and UWP more in alignment towards .NET 5, but in its current form we’re at a loss on how to develop XAML island powered applications from within this using Rider.

Anyone got a clue or can assist with finding a workaround on how we can workaround this? Or should this be seen as a bug and/or somehow patched in Rider?

 

Many thanks in advance & to the Rider team: keep up the great work on such an excellent IDE!

Peter Vrenken

Please sign in to leave a comment.