Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
How to make .NET 6.0 Hot Reload work on the simplest "Hello, World" console application?

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:

enter image description here

Why doesn't the Hot Reload work? Am I doing something wrong? This blog post states it should also work for Console apps.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

If you change Task.Delay(1000).Wait() to await Task.Delay(1000) then hot reload on save will work. It seems when a thread is blocked, hot reload doesn't want to work.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda