Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XAML Hot Reload not working running MAUI app on Windows Machine #3237

Closed
vsfeedback opened this issue Nov 3, 2021 · 11 comments
Closed

XAML Hot Reload not working running MAUI app on Windows Machine #3237

vsfeedback opened this issue Nov 3, 2021 · 11 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging area-xaml XAML, CSS, Triggers, Behaviors t/bug Something isn't working

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


! [image.png] (https://aka.ms/dc/image?name=B1515664df46945f59725e8befb796773637711123691104432_20211029-095247-image.png&tid=1515664df46945f59725e8befb796773637711123691104432)


Original Comments

Feedback Bot on 11/1/2021, 00:04 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Ken Annable on 11/1/2021, 04:17 AM:

In the step #8 above I indicated pressing F5 when the DLL load exception occurs. I was able to fix this issue by uninstalling VS 2022 and all SDKs, Frameworks, and Runtimes using the “Apps”->“Apps & features” view in Settings. Then manually cleaning up directories in “Program Files”, “Program Files (x86)”, “ProgramData”, and “Users\[myusername]”. Next I ran DiskCleanup, rebooted, and reinstalled VS Community 2022 Preview 7. Performing these steps corrected the DLL load exception but did NOT fix the XAML Hot Reload issue in this ticket.


Original Solutions

(no solutions)

@jsuarezruiz jsuarezruiz added area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging area-xaml XAML, CSS, Triggers, Behaviors labels Nov 3, 2021
@ninbura
Copy link

ninbura commented Dec 18, 2021

I'm experiencing the same issue.

I tried uninstalling and searching my c drive for anything that mentioned "visual studio" and deleted everything. I even went through the registry and deleted a bunch of keys before rebooting and re-installing. When re-installing I only checked components relevant to maui, still no luck.

Hot Reload doesn't work at all, doesn't matter what settings I have enabled, or if the app is running elevated.

@chaoyebugao
Copy link

Same problem with Windows Machine.

@SergVorontsov
Copy link

Faced the same problem (for all simulators (android, windows)).
Code changes were picked up correctly, but not for XAML.

@brendanalexdr
Copy link

Same here. No hot reload for any platform deployment.
[3:50:16 PM] (maui) .NET6 Project references MAUI. [3:54:44 PM] (maui) .NET6 Project references MAUI. [3:54:44 PM] (maui) Starting Hot Reload Session... [3:54:45 PM] XAML Hot Reload initializing... [3:54:48 PM] (maui) Failed to initialize the HotReload.Maui Agent TAP [3:54:48 PM] (maui) Caught exception in SetupAgent at 102: System.TypeLoadException: Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null) at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28 at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 95 at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28 at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 95 [3:54:51 PM] (maui) Caught exception in InitAgents at 134: System.AggregateException: One or more errors occurred. (Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null)) ---> System.TypeLoadException: Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null) at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28 at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 103 at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.VisualTreeChanged(Object sender, VisualTreeChangeEventArgs e) in D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 65 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Xamarin.HotReload.HotReloadAgent.<>c__DisplayClass31_1.<InitAgents>b__2(Task t) in D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:line 149 at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Xamarin.HotReload.HotReloadAgent.<>c__DisplayClass31_1.<InitAgents>b__2(Task t) in D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:line 149 [3:54:51 PM] (maui) HotReload: Initialized Agent. [3:54:58 PM] Caught exception in AgentStatusChangedHandler at 313: System.Exception: One or more errors occurred. (Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null)) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) [3:54:58 PM] XAML Hot Reload encountered a problem and failed to start. Use Help -> Report a Problem if the issues persists. [3:54:58 PM] Stopping All Hot Reload sessions due to Failed ... [3:54:58 PM] (maui) Stopping a Hot Reload session due to Failed ... [3:54:58 PM] Stopped Hot Reload session.

@omiimo
Copy link

omiimo commented Dec 26, 2021

Facing same issue.
Hot reload is not working for any platform.
When I deployed default MAUI project to Android, hot reload did not work.
(did a clean vs install, bud did not help)

[10:04:25 AM] (MauiApp21) .NET6 Project references MAUI.
[10:04:25 AM] (MauiApp21) Starting Hot Reload Session...
[10:04:26 AM] XAML Hot Reload initializing...
[10:04:25 AM] (MauiApp21) Failed to initialize the HotReload.Maui Agent TAP
[10:04:25 AM] (MauiApp21) Caught exception in SetupAgent at 102: System.TypeLoadException: Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null)
at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28
at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 95
at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28
at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 95
[10:04:26 AM] (MauiApp21) Caught exception in InitAgents at 134: System.AggregateException: One or more errors occurred. (Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null))
---> System.TypeLoadException: Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null)
at Xamarin.HotReload.Xaml.VisualTreeService.DiagnosticVisualTreeService..ctor(ILogger logger) in D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:line 28
at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent(IServiceProvider provider) in D:\a_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 103
at Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.VisualTreeChanged(Object sender, VisualTreeChangeEventArgs e) in D:\a_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:line 65
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Xamarin.HotReload.HotReloadAgent.<>c__DisplayClass31_1.b__2(Task t) in D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:line 149
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Xamarin.HotReload.HotReloadAgent.<>c__DisplayClass31_1.b__2(Task t) in D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:line 149
[10:04:26 AM] (MauiApp21) HotReload: Initialized Agent.
[10:04:33 AM] Caught exception in AgentStatusChangedHandler at 313: System.Exception: One or more errors occurred. (Could not load type of field 'Xamarin.HotReload.Xaml.VisualTreeService.VisualTree.ApplicationWrapper:dispatcher' (0) due to: Could not resolve type with token 01000045 from typeref (expected class 'Microsoft.Maui.Controls.IDispatcher' in assembly 'Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.Controls.IDispatcher member:(null))
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[10:04:33 AM] XAML Hot Reload encountered a problem and failed to start. Use Help -> Report a Problem if the issues persists.
[10:04:33 AM] Stopping All Hot Reload sessions due to Failed ...
[10:04:33 AM] (MauiApp21) Stopping a Hot Reload session due to Failed ...
[10:04:33 AM] Stopped Hot Reload session.

@brendanalexdr
Copy link

Updated to Visual Studio 2022 Preview 1.1. Hot reload still broken for all platforms.

@SergVorontsov
Copy link

After update to VS Version 17.1.0 Preview 2.0 all works property.

@omiimo
Copy link

omiimo commented Jan 9, 2022

Issue is fixed with VS Preview 2.0 update.

@dracan
Copy link

dracan commented Feb 5, 2022

Just trying MAUI, and I'm using VS 17.1.0 Preview 5.0, and it's not working at all. I'm debugging, and the hot reload button isn't greyed out - but when I click it, nothing happens. I've tried using both the Android emulator, or just building as a Windows app.

@dracan
Copy link

dracan commented Feb 5, 2022

Sorry, seems to have now magically started working! Didn't change anything.

@drasticactions
Copy link
Contributor

This issue was originally tied to a mismatch between versions of MAUI and XAML Hot Reload. There were underlying changes in MAUIs API that broke XAML Hot Reload if you happened to upgrade before that shipped with Visual Studio.

That was addressed in an earlier VS release, it shouldn't be an issue now for this specific case.

@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2022
@samhouts samhouts added the t/bug Something isn't working label Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging area-xaml XAML, CSS, Triggers, Behaviors t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants