Describe the bug
I can't seem to get debugging to work.
Debugging a C# project using VS Code works perfectly.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
My program is run and the breakpoint I set was triggered.
Environment (please complete the following information):
Hey @drguildo :wave:,
Thank you for opening an issue. We will get back to you as
soon as we can. Also, check out our OpenCollective and consider
backing us.
https://opencollective.com/ionide
PS.: We offer
backersupport for all backers. Don't forget to addbackerlabel when you start backing us :smile:
It's probably irrelevant but debugging also works in Visual Studio Community 2019.
Was this the OmniSharp error that you saw?

Not being able to auto-create the configurations does seem to be a bug, although it might be a bug with OmniSharp rather than ionide?
Launch.json will open and do nothing because you need to configure it correctly. Start by clicking the little cog:

then (if auto generating the config failed) you can click "Add Configuration..." in the bottom right:

and select "Launch a .NET Console App":

Make sure to change the "program" property to match where your built dll will be (and remove the angled brackets):

Then you will need to create the "build" task referenced by the "preLaunchTask" property. You can do this by clicking Terminal -> Configure Tasks...

Then select create task.json file from template and then .net core:

At this point you should have two files inside a .vscode folder at the root of your working directory - launch.json and tasks.json. launch.json should look like:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/newConsoleApp.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
}
]
}
and tasks.json should look like:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet build",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
you should now be able to start debugging with the correct launch configuration:

If an error box appears saying that the .dll cannot be found, likelihood is that you've misspelled part of the path in the "program" property of launch.json.
Encountering same issue on Arch Linux (Ctlos) using vscode-oss:
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Ctlos
OS Version: net-1.0_20200407
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.201/
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
3.1.201 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Debugging just hangs, never reaches breakpoints (even after I configured task.json and launch.json)
Omnisharp also saying "Cannot create .NET debug configurations. The OmniSharp server is still initializing or has exited unexpectedly."
Also, cannot run without debugging either. :disappointed:
@LukeBurgessYeo Thanks. I was able to get debugging working using your guide.
Maybe related ? #3694
Have a look at this
F# projects are not officially supported by this extension -- this extension tries to be smart about the launch.json that it generates, but being smart requires project understanding, and OmniSharp only understands C# projects. So definitely the best option would be for the F# extension (which I think the most popular one is Ionide-fsharp) to provide smart templates for launch.json based on understanding the project, or even just really basic templates. So if Ionide-fsharp doesn't, you may want to log an issue or follow up.
I think what happened is that Omnisharp does not understand F# project since it's not designed to support F# support.
Most helpful comment
Was this the OmniSharp error that you saw?

Not being able to auto-create the configurations does seem to be a bug, although it might be a bug with OmniSharp rather than ionide?
Launch.json will open and do nothing because you need to configure it correctly. Start by clicking the little cog:

then (if auto generating the config failed) you can click "Add Configuration..." in the bottom right:

and select "Launch a .NET Console App":

Make sure to change the "program" property to match where your built dll will be (and remove the angled brackets):

Then you will need to create the "build" task referenced by the "preLaunchTask" property. You can do this by clicking Terminal -> Configure Tasks...

Then select create task.json file from template and then .net core:

At this point you should have two files inside a .vscode folder at the root of your working directory - launch.json and tasks.json. launch.json should look like:
and tasks.json should look like:
you should now be able to start debugging with the correct launch configuration:

If an error box appears saying that the .dll cannot be found, likelihood is that you've misspelled part of the path in the "program" property of launch.json.