Microsoft-ui-xaml: Xaml Islands: Hot reload and designer tools are broken in VS 16.7

Created on 3 Jul 2020  ·  18Comments  ·  Source: microsoft/microsoft-ui-xaml

Describe the bug
A recent VS preview prevents me from using hot reload and the designer tools in XAML islands, making it utterly slow to iterate on XAML islands code.

Steps to reproduce the bug

  1. Use the VS preview
  2. Run the C++ sample from https://github.com/marb2000/XamlIslands/tree/master/1903_Samples/CppWinRT_Win32_App
  3. Look at the live visual tree, or try editing a XAML file

Expected behavior
The live visual tree displays XAML controls, and hot reloading works

Screenshots
Broken (VS Preview 16.7): image
Working (VS Stable 16.6): image

Version Info

NuGet package versions: https://github.com/marb2000/XamlIslands/blob/master/1903_Samples/CppWinRT_Win32_App/SampleCppApp/packages.config (this doesn't matter in the end, it reproduces even after updating all the packages in the solution)

VS Preview version: 16.7.0 Preview 3.1


| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| May 2020 Update (19041) | Yes |
| November 2019 Update (18363) | |
| May 2019 Update (18362) | |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |


| Device form factor | Saw the problem? |
| :----------------- | :--------------- |
| Desktop | Yes |
| Xbox | |
| Surface Hub | |
| IoT | |

area-Tooling needs-triage team-Markup

Most helpful comment

Fixed in 16.8 Preview 4!

All 18 comments

@fabiant3 @stevenbrix FYI

Hi @sylveon, unfortunately, XAML Islands v1 never supported Live Visual Tree and Hot Reload, and there is no plan for update XAML Islands v1 given all our efforts are in WinUI 3.

On the bright side, we are planning to support Live Visual Tree and Hot Reload for Desktop WinUI 3. TBD yet, but we do want it :). @fabiant3, @RealTommyKlein, @stevenbrix, and others are working on making this happen; witch requires very surgical work.

We want to support Live Visual Tree and Hot Reload for WinUI 3's Islands when we'll release the XAML Islands support. TBD as well, also it's even more challenged than the Desktop scenario.

I'm confused then. Why does it work in VS 16.6 (which is the current stable release)?

Here's a gif of both literally working on an XAML island project:
PleasantNeatAbomasnow

This is super interesting. We tested Hot Reload in XAML Islands v1 long time ago and it didn't work. So we investigated the causes and created tasks in our backlog to do the work. The same for Live Visual Tree (LVT), where we needed to hook the XAML tree into the WPF tree.
If Hot Loaded worked on the VS 2019 16.6 was pure causality and unintentional. 🤷‍♀️

I don't think @Sylveon is using WPF, which is why it works. The VS debugger engine that hooks up the Live Visual Tree just looks for certain module's being loaded in the process. In a MFC C++ Xaml Islands app, Windows.UI.Xaml.dll is loaded, the debugger recognizes that, and the Windows Xaml visual tree is displayed. There is no Live Visual Tree implementation for an MFC (or even WinForms) app, so there is nothing to contend with. When you are using XAML Islands in a WPF app, WindowsBase.dll is loaded first, the debugger recognizes that, and the WPF visual tree is displayed. The work we have on the backlog is to recognize both and stitch them together. If I recall correctly, you can native debug only a WPF app using Xaml Islands, and you'll get the Windows Xaml visual tree. This happens because the managed assemblies won't be available to the native debugger, and so the logic to use Windows Xaml visual tree kicks in.

I'm writing a native C++ app indeed (not with MFC however). Being able to hot reload made working on the code much faster and made less frequent a weird issue where sometimes when changing the XAML the build would get stuck in the XAML codegen phase until I cleaned and rebuild. Live Visual Tree and Live Property Explorer also made dealing with Binding issues or etc much easier.

The issue here is it seems that is somehow broken in VS preview. The live visual tree "recognizes" that there is UWP XAML content, because it shows the process in there, but it doesn't show any actual content. Same goes for hot reloading not actually hot reloading anything.

Could this be reopened?

@sylveon, I would reopen the bug, if we had supported the LVT/HotReload features properly investing on:

  1. Doing the right things in the tools: write code, adjust tools, etc.
  2. Testing the features and adding them to our testing matrix,
  3. Aware Visual Studio of the support of these features in XAML Islands so they are not broken in the updates.

But we haven't executed the plan yet, the features worked unintentionally in some specific scenarios. We are planning to support LVT/HotReload in WinUI 3 doing the things right. Does this make sense for you?

Right, but I can't really migrate to WinUI 3 without acrylic support, so I'll be stuck to system XAML islands until it does.

@sylveon that's fair. I'll forward this to the Visual Studio team so that they are aware. Did you file a VS feedback issue?

/cc @chabiss

No, because I've generally been told to fill my issues with XAML here, but I can do that if requested.

@sylveon no need to fill a VS issue because it will circle back to us. You are doing right filling up these bugs here.

About Acrylic, I hope we can give an update to the community soon, we are still investigating it.

Maybe I'm missing something. I thought this issue was about a recent regression in VS16.7 Preview when using the same version of Windows that works with VS16.6.

Yes, it's a regression in 16.7. Same code, same OS version: VS 16.7 preview doesn't work but 16.6 does.

VS 16.7 is now shipped to the public. This is universally broken.

@sylveon I have good news, the fix for this will be in 16.8 :)

🥳

Fixed in 16.8 Preview 4!

Was this page helpful?
0 / 5 - 0 ratings