Visual Studio Hot Reload for code changes not working

Riffy 276 Reputation points
2022-01-19T15:38:45.747+00:00

Hi

I have started using VS 2022.

I am having an issue with Hot Reload not working with C# code changes with Android project, even though it is enabled for debugging:

166410-image.png

When doing code changes and clicking on the Hot Reload, I get the following:

166436-image.png

I have looked at settings as per display, but cannot see why it is not working.

166386-image.png

Any suggestions would be welcome.

Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
{count} votes

Accepted answer
  1. Michael Taylor 47,966 Reputation points
    2022-01-19T15:59:09.397+00:00

    XAML Hot Reload and Edit and Continue are 2 different things. It appears you are having an EnC message, not XHR. XHR is focused on changes to the XAML, not the source code. With XHR enabled then changes you make to the XAML file are pushed down so you can see them immediately (basically like web apps work). EnC kicks in for source code changes. With EnC when you make a source code change the changes are recompiled and the existing code in memory is patched so your changes are seen without restarting the debugger. But EnC cannot swap out all changes so there are some changes that require you to restart the debugger. That is what the message you're getting is saying. You have made a change that EnC cannot patch and therefore you have to restart the app before they take effect. The current list of things that can be patched is discussed here.

    Note in your XHR configuration you are using full page mode but Changes Only is the recommended approach as discussed here. You should review those docs to ensure you have configured XHR properly as there is also a debugger setting that needs to be set for Xamarin (at least based upon the docs).

    0 comments No comments

0 additional answers

Sort by: Most helpful