How to debug a .net core application in Visual Studio Code?

Viewed 146

I am trying to debug a console application in visual studio code. It is written in C# and I am trying to build it using .NET Core 3.1. But as soon as I start debugging it says "The program '[888] MyConsoleApp.dll' has exited with code 0 (0x0)."

I have written a console.readline() in my code but the console window doesn't stop for it. It just opens and closes immediately.

My launch.json looks like this

{ 
"version": "0.2.0", 
"configurations": [ 
{ 
"name": ".NET Core Launch (console)",
"type": "coreclr", 
"request": "launch", 
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/MyConsoleApp.dll", 
"args": [], 
"cwd": "${workspaceFolder}/bin/Debug/netcoreapp3.1/",
"console": "externalTerminal",
"externalConsole": true,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"justMyCode":false,
"logging": {
    "moduleLoad": false
} 
},
{
  "name": ".NET Core Attach",
  "type": "coreclr",
  "request": "attach",
  "processId": "${command:pickProcess}"
}
] 
} 

and my tasks.json looks like this

{ 
"version": "2.0.0", 
"tasks": [ 
{ 
"label": "build", 
"command": "dotnet build", 
"type": "shell", 
"group": "build", 
"presentation": { 
"reveal": "silent" 
}, 
"problemMatcher": "$mscompile" 
} 
] 
}

When I build my project using .net 4.7.2 then the debug works fine. But, the issue is only with .net core.

0 Answers
Related