Wednesday, May 26, 2021

Introducing .NET Hot Reload in Visual Studio 2019 Version 16.11.0 Preview 1.0

A couple of weeks back I wrote a post about Early Support for .NET Hot Reload is Now Available with .NET 6 Preview 3, and there I went through one of the greatest features expected to go to RTM with .NET 6, which is .NET Hot Reload. There at the time of me writing the post, this feature was only available with dotnet command, and not within Visual Studio.

If you have installed the latest Preview of Visual Studio that was announced earlier today during the Microsoft Build 2021, which is Visual Studio 2019 Version 16.11.0 Preview 1.0, you might have noticed something new when you are on a debugging session in Visual Studio.
Apply Code Changes
So with Visual Studio 2019 Version 16.11.0 Preview 1.0, we now have .NET Hot Reload experience through Visual Studio (actually this was initially available with Visual Studio 2019 Version 16.10.0 Preview 2.0).

So how this is going to work is something like below. I am trying the same project that I used in my previous post, this time I am debugging through Visual Studio.
.NET Hot Reload in Visual Studio 2019 Version 16.11.0 Preview 1.0
We just need to do the code change while Debugging and then hit Apply Code Changes and that's it.

This is still in it's early stages, it's going to get improved and going to support more project types with upcoming releases. Currently, for this to work a debugging session is required, but with Visual Studio 2022, we should be able to use .NET Hot Reload without needing the debugger, this means when we do CTRL+F5 and do code changes, .NET Hot Reload feature should be patching the running application.

For more details on this feature, please go through this post:

Great things to look forward to!

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment