After lots of reinstallion, 100+?, I came across with this information then problem solved.
It is very frustrating the recent quality of Visual Studio 2022 after 17.2. Each update gets me reinstall loops again, again and again, just because something broken.
This time, MAUI (WinUI 3) XAML Hot Reload won't work.
XAML Hot Reload
So I created 3 VMs and installed with different detail of workloads, and tried to figure out "What's wrong". But I failed.
The error seems random. However, I did get some thing strange.
The Hot Reload was "working" after installaion and I left the VM on. After awhile back, I stopped debugging and restarted to debug, the working one became "not working" somehow over time, so I compared two snapshot, one work, one did not. After comparing installion configuration, run with user, run with admin, MAUI App with .net 6.0, MAUI App with template 7.0, both registry, both disk contain (entire C:). I found nothing, all identical as they should be.
Checking Logs:
Event Log, AppData\Local\Temp\VSLogs, AppData\Local\Xamarin\Logs\17.0, the Output of VS
However, the Output: debug. Did make me tracing the component binding process, also found nothing.
The One "Not Wotking":
The One "Not Wotking"
The One "Working":
The One "Working"
Huge data but no luck:
Assembly binding log
Windows Policy, no luck: Audit Access Deny
I have to say the error logs are well hidden.
After lots of google thing, I came across with this information then problem solved. It is a Permission problem.
And then I dig a little further, here i found:
VS Output:
WindowsAppRuntime, installed at first run, may be update after
C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe
The list of files that Permissions are different (Not Working vs. Working):
- CoreMessagingXP.dll
- dcompi.dll
- dwmcorei.dll
- DwmSceneI.dll
- DWriteCore.dll
- marshal.dll
- Microsoft.DirectManipulation.dll
- Microsoft.Foundation.winmd
- Microsoft.Graphics.winmd
- Microsoft.InputStateManager.dll
- Microsoft.Internal.FrameworkUdk.dll
- Microsoft.UI.Composition.OSSupport.dll
- Microsoft.UI.Input.dll
- Microsoft.UI.Windowing.Core.dll
- Microsoft.UI.winmd
- Microsoft.Web.WebView2.Core.dll
- Microsoft.Web.WebView2.Core.winmd
- resources.pri
- WindowsAppRuntime.png
- WindowsAppSdk.AppxDeploymentExtensions.Desktop.dll
- wuceffectsi.dll
- en-GB\Microsoft.ui.xaml.dll.mui
- en-GB\Microsoft.UI.Xaml.Phone.dll.mui
- Microsoft.UI.Xaml\Assets\NoiseAsset_256x256_PNG.png
Conclution:
- The "Microsoft.WindowsAppRuntime" will get installed on first run and will not get uninstalled with Visual Studio uninstallation.
- The "Microsoft.WindowsAppRuntime" may get updated and permission also get changed.
- The ACL permission of Microsoft.WindowsAppRuntime folder and files in it may change somehow after some time, same version (Did not go this far to see why).
- Manipulate the Permission manually does the trick
- Simple Rest (SYSTEM access right is required, PsExec):
psexec64 -i -s cmd.exe /k icacls.exe "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe\*.*" /reset /t
- Minimun Reset (for my case, as soon as this reset done, the hot reload shows up when debug, remember to restart debug):
psexec64 -i -s cmd.exe /k icacls.exe "C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe\Microsoft.Internal.FrameworkUdk.dll" /reset