Consider this C# 10 / .NET 6.0 / Visual Studio 2022 "Hello, World" console application:
// See https://aka.ms/new-console-template for more information
foreach (int _ in Enumerable.Range(0, 100))
{
Console.WriteLine("Hello, World!");
Task.Delay(1000).Wait();
}
If I run this program with debugging, or without debugging, changing the World
to Earth
and then saving the file and clicking "Hot Reload" (Apply Code Changes) button does nothing. The program continues to write to console Hello, World!
.
I can force the application to change the string without restarting without using Hot Reload, by using Edit and Continue instead, i.e. by making changes while the application is in break mode.
I did enable all the options for Hot Reload:
Why doesn't the Hot Reload work? Am I doing something wrong? This blog post states it should also work for Console apps.