Trottero / dotnet-watch-attach

Dotnet watch attach vscode plugin
7 stars 7 forks source link

Debugger requires 2 clicks to stop #16

Open austin-owensby opened 10 months ago

austin-owensby commented 10 months ago

When I run the the extension everything works fine, but when I'm ready to stop I have to click the stop button twice before it actually stops.

I was able to reproduce this on your dotnet-watch-attach-sample repo and got the same behavior using only the necessary extensions: Extension Name Installed Version
.NET Watch Attach 0.2.6
C# 2.12.19
.NET Install Tool 2.0.0

Environment:

Let me know if there's anything else I need to provide you to help look into this. If I have time I'll try and take a look at the source code myself.

Watch Attach output when starting:

[WATCH ATTACH] [21:54:47] Attaching to weather.exe...
[WATCH ATTACH] [21:54:48] Successfully attached to weather.exe

Terminal output when starting:

 *  Executing task: C:\Program Files\dotnet\dotnet.exe watch run C:\Users\aowensby\OneDrive\Desktop\Projects\dotnet-watch-attach-sample/weather.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary 

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...
  Determining projects to restore...
  All projects are up-to-date for restore.
  weather -> C:\Users\aowensby\OneDrive\Desktop\Projects\dotnet-watch-attach-sample\bin\Debug\net6.0\weather.dll
dotnet watch 🚀 Started
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:7081
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5177
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\aowensby\OneDrive\Desktop\Projects\dotnet-watch-attach-sample\

Watch Attach output after first stop:

[WATCH ATTACH] [21:56:2] Child debug session terminated, restarting...

Terminal output after first stop:

dotnet watch ❌ Exited with error code -1
dotnet watch ⏳ Waiting for a file to change before restarting dotnet...

Watch Attach output after second stop:

[WATCH ATTACH] [21:56:40] Host debug session terminated, cleaning up...
[WATCH ATTACH] [21:56:40] A task was configured; terminating the task launched by Watch Attach
austin-owensby commented 10 months ago

After doing a bit of research, the first debug session I stop has a type of coreclr and the 2nd is dotnetwatchattach

Trottero commented 10 months ago

After doing a bit of research, the first debug session I stop has a type of coreclr and the 2nd is dotnetwatchattach

This is probably due to a change in vscode - the UI now probably selects the child process that watch attach creates and makes you manipulate that instead of the (intended) parent process.

I am currently very busy but if you manage to figure out how to fix it I am open to PR's :)

hackathi commented 6 months ago

Just chirping in here: I also encounter this problem, additionally, every rebuild triggered through watch freezes the VSCode UI for about 30s, sometimes longer.

I have unfortunately no clue how to debug a VSCode extension, nor a setup. If someone knows of a good tutorial, I'd be open to give debugging and PR'ing a shot.