Closed sake402 closed 3 months ago
Updated dotnet to 7.0.101 and still doesn't work. This time it says update applied but it wasn't
dotnet watch -v
dotnet watch ⌚ Project supports hot reload and was configured to run with the default run-command. Watching with hot-reload
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
💡 Press "Ctrl + R" to restart.
dotnet watch 🔧 Building...
dotnet watch 🚀 Started 'D:\Program Files\dotnet\dotnet.exe' 'msbuild /t:Build /restore /nologo' with process id 28704
Determining projects to restore...
All projects are up-to-date for restore.
csl -> D:\Users\ojesc\Desktop\csl\bin\Debug\net7.0\csl.dll
dotnet watch ⌚ Process id 28704 ran for 3477ms
dotnet watch ⌚ Running MSBuild target 'GenerateWatchList' on 'D:\Users\ojesc\Desktop\csl\csl.csproj'
dotnet watch 🚀 Started 'D:\Program Files\dotnet\dotnet.exe' 'msbuild /nologo D:\Users\ojesc\Desktop\csl\csl.csproj /p:_DotNetWatchListFile=C:\Users\ojesc\AppData\Local\Temp\tmp3B0D.tmp /nologo /v:n /t:GenerateWatchList /p:DotNetWatchBuild=true /p:DesignTimeBuild=true /p:CustomAfterMicrosoftCommonTargets=D:\Program Files\dotnet\sdk\7.0.101\DotnetTools\dotnet-watch\7.0.101-servicing.22579.2\tools\net7.0\any\DotNetWatch.targets /p:CustomAfterMicrosoftCommonCrossTargetingTargets=D:\Program Files\dotnet\sdk\7.0.101\DotnetTools\dotnet-watch\7.0.101-servicing.22579.2\tools\net7.0\any\DotNetWatch.targets' with process id 29448
dotnet watch ⌚ Process id 29448 ran for 1331ms
dotnet watch ⌚ Watching 2 file(s) for changes
dotnet watch ⌚ launchSettings does not allow launching browsers.
dotnet watch ⌚ Skipping configuring browser-refresh middleware since this is not a webapp.
dotnet watch 🔥 HotReloadProfile: Default.
dotnet watch ⌚ Connecting to the application.
dotnet watch 🚀 Started 'D:\Users\ojesc\Desktop\csl\bin\Debug\net7.0\csl.exe' 'run' with process id 27968
dotnet watch ⌚ Running csl with the following arguments: run
dotnet watch 🚀 Started
Hello, World!
Hello, World!
Hello, World!
dotnet watch 🔥 Hot reload capabilities: Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters.
Hello, World!
Hello, World!
dotnet watch ⌚ File changed: .\Program.cs.
Hello, World!
Hello, World!
Hello, World!
dotnet watch ⌚ Received successful apply from delta applier.
dotnet watch 🔥 Hot reload of changes succeeded.
dotnet watch 🔥 Hot reload change handled in 2605.1667ms.
Hello, World!
Hello, World!
The console message still doesn't change.
/bump same here
Looking for this to work as well. Never understood why Visual Studio cant work with other frameworks and allow hot reload to work with for example typescript, cshtml files for MVC views and anything Blazer. I just use VS Code to achieve some of these and some help from tsc --watch or nodejs to watch and reload part of things that I know are setup in certain way. Would be good to at least see this working for one kind of setup as example. To be honest the gif on top of this page https://learn.microsoft.com/en-us/visualstudio/debugger/hot-reload?view=vs-2022#visual-studio-2022-with-a-net-app-but-not-using-the-debugger does not make much useful content to developers than having a code repo in github that shows scenarios that you have on same page for .net 6 app and .net core scenarios.
Please try the latest SDK + workload, seems that they did some patches, however, in my case is still not working!
It says Hot reload of changes succeeded, but no change in the console message
This is expected as the changes only take effect in a new invocation of the updated code. The loop however is never invoked again, it continues running the old version. If you make the same change in the following code it will work:
while(true){
Print();
Thread.Sleep(500);
}
void Print()
{
Console.WriteLine("Hello, World! Guzdot");
}
Describe the bug
While hot reload was announced to be the game changer for dotnet development, the fact remains that some of us has never gotten it to work. Enabling it in Visual studio brings productivity to a halt and have had it disabled since dotnet 5. Today, I felt to give it another try perhaps something would have changed.
In our large solution, from Visual studio, it still doesnt work. Even adding a simple field to a class ends up with
So I created a basic console app with just the Program .cs and added this to it
Did
dotnet watch --verbose
And made changes to
Console.WriteLine("Hello, World! Guzdot");
string parameter. It saysHot reload of changes succeeded
, but no change in the console messageIn our large solution however, the behaviour is different
Note the absence of this line
When a file is changed, we get this
Just notification that file changed and nothing else.
When we terminate the aplication with Ctrl+C on console, we finall have