Microsoft Technical Takeoff: Windows and Microsoft Intune
Oct 24 2022 07:00 AM - Oct 27 2022 12:00 PM (PDT)
Using XAML Islands on Windows 10 19H1: fixing the "Catastrophic failure" exception
Published Mar 18 2019 11:06 AM 12.9K Views

As you probably know, the AppConsult team has a strong focus on Windows app modernization. XAML Islands is one of the main technologies we're working with and with my buddy Sebastien Bovo we have delivered a full workshop about it at Microsoft Ready, an internal Microsoft event which gathers more than 5000 engineers from all around the world.

XAML Islands is one of the technologies which allows to modernize your existing WPF and Windows Forms applications without rewriting them from scratch. You can embed, in fact, controls from the Universal Windows Platform and, as such, bring a bit of Fluent design, touch and ink support also to your Win32 applications.

The APIs which make XAML Islands possible are included in Windows 10, but to make easier to consume them the Windows team has built a set of controls which have been included in the Windows Community Toolkit. This way, embeedding a UWP control in your Win32 application is easy as dragging and dropping a control inside your window and set some properties.

XAML Island support has been added in preview in Windows 1809, but it's on Windows 10 19H1 (the next major Windows update) where it will reach its full potential. As a consequence, I've finally decided to make the switch and I moved my Surface Pro to the Windows Insider program. As such, at the moment of writing, I'm now running Windows 10 18358.1.

However, when I launched the application me and Sebastien have built for the XAML Island lab, it started to crash when I was opening one of the windows which hosts a UWP control. The error was the following one:


System.Exception: 'Catastrophic failure WindowsXamlManager and DesktopWindowXamlSource are supported for apps targeting Windows version 10.0.18226.0 and later. Please check either the application manifest or package manifest and ensure the MaxTestedVersion property is updated.'



After some investigations and with the help of my friend Alexandre, I've found two ways to solve this problem.


MSIX packaging

The first way to solve this problem is to package the application as MSIX and use, as target SDK, the 19H1 one. This way, the application will be compiled with the newest version of the SDK, which includes support for all the latest XAML Island features, and the error will go away.

As first step, you have to go to the website, login with a Microsoft Account enrolled in the Windows Insider program and click on Get SDK Insider Preview. At the time of writing, the most recent SDK is 18351. Once the download is complete, double click on the ISO file, which will be mounted as a virtual drive. Open it in File Explorer and double click on the WinSDKSetup.exe file to start the installation.

Once the setup is finished, open your WPF or Windows Forms solution in Visual Studio. Then right click on it in Solution Explorer and choose Add -> New project. If you're using Visual Studio 2019, just type packaging in the search box to find the Windows Application Packaging Project. If you're using Visual Studio 2017, instead, you will find under the category C# -> Windows Universal.


packaging project.png


As first step, you will be asked which Windows 10 version you want to target. Make sure to choose, as Target version, the Insider SDK you have just installed:




Once the project has been created, identify the Applications section in Solution Explorer and right click on it. Choose Add reference: Visual Studio will show the list of projects included in the solution. Choose the one which contains your WPF / Windows Forms application and press OK. Now your application has been packaged. If you set the new project as startup and you deploy it, you will actually launch the packaged version of your application inside the MSIX container.


solution explorer.png


If you now try to open a windows of your application which includes a XAML Island control, it will work just fine and you'll be able to see and interact with it.


Add an application manifest

The second option is to add an application manifest to your Win32 application. This will allow to leverage XAML Islands without having to package your application as MSIX. But there's an advantage also in the MSIX scenario: you'll be able, in fact, to package your application but still target 1809, without having to install the 19H1 SDK and retarget the app.

To add an application manifest, right click on your WPF or Windows Forms project and choose Add -> New item. Choose XML File from the list, name it app.manifest and then copy and paste the following content:


<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">

      <!-- Windows 10 -->
      <maxversiontested Id="10.0.18358.0"/>
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />



The maxversiontested element inside the application node must match the most recent available version of Windows 10 19H1. Ideally, once 19H1 will ship, it should include the final version number. For the moment, I've specified the most recent Insider build at the time of writing, which is 18358.

The second step is to edit the .csproj to add a reference to the manifest file we have just added. We can do this through the visual editor. Right click on the project and choose Properties, then in the Resources section type app.manifest in the Manifest field, as highlighted below:




That's it! Now you launch your WPF or Windows Forms application, even not packaged as MSIX, and you should see the UWP controls being rendered just fine, wihout any other catastrophic failure =)


Wrapping up

In this post we have seen how to fix the catastrophic failure exception that you may get if you have started to integrate XAML Island in your WPF and Windows Forms app on Windows 10 1809 and then you moved to 19H1. If you want to take a deeper look to XAML Islands, the official GitHub repository is a great starting point, since it contains many samples you can play with.

Happy coding!

Version history
Last update:
‎Mar 19 2019 01:37 AM
Updated by: