Visual Studio Code on exit kills a external .exe process to which a C# debugger was attached

248 Views Asked by At

I am using vs code and ms-dotnettools.csharp extension to debug an external .exe process writen in C# .NET 4.6 Framework. I am attaching to this process with below configuration

"configurations": [
     {
         "name": "Attach to ConsoleApp",
         "type":"clr",
         "request": "attach",
         "processName": "ConsoleApp",
     }]

This works pretty fine to the point when I close Visual Studio Code after a breakpoint is hit and make some debug steps. The application to which the process was attached crashes without any information, even the windows Event viewer is empty of any information. However, stopping the debugger, without closing the VSCode works very fine, this is why I assume this could be a vscode issue, not the C# extension itself. Although this crash is not happening each time, for example, I more often reproduce it on a slower VM than on a faster local system.

What happens when VSCode is closing? Will it stop the running extension gracefully?

Steps to Reproduce:

  1. Build a .NET x64 exe application with DebugType portable
  2. Run the exe.
  3. Open VSCode with C# extension.
  4. Run the debugger that will attach to the running exe.
  5. Place a breakpoint.
  6. Breakpoint is hit.
  7. Make some debug steps.
  8. Close Visual Studio Code.
  9. The .exe to which the debugger was attached crashes without any information.
  • Does this issue occur when all extensions are disabled?: No. This issue requires the ms-dotnettools.csharp extension
  • VSCode Version: 1.51.1
  • OS Version: Windows 10.0.18363
  • ms-dotnettools.csharp Version: 1.23.6
0

There are 0 best solutions below