Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set up Kestrel debugging with Visual Studio Code on Windows?

I've had a difficult time finding instructions on how to set up debugging within Visual Studio Code on Windows (10 if it matters) using the launch.json file.

Can someone define how to set this up?

like image 420
Kevin Kraus Avatar asked Dec 04 '15 20:12

Kevin Kraus


People also ask

How do I enable debugging in Visual Studio Code?

To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file. However, for most debugging scenarios, creating a launch configuration file is beneficial because it allows you to configure and save debugging setup details.

How do I get the Debug window in Visual Studio?

To enable the Debug Location toolbar, click in an empty part of the toolbar area and select Debug Location from the dropdown, or select View > Toolbars > Debug Location. Set a breakpoint and start debugging. When the breakpoint is hit, execution pauses and you can see the location in the Debug Location toolbar.

How do I set Debug configuration in Visual Studio?

In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).


1 Answers

To debug using visual studio code you have to ensure that the configuration that you select in the debug tab is properly set up in the launch.json. The configurations in launch.json should look like this

"configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/Example.dll",
        "args": [],
        "cwd": "${workspaceRoot}/",
        "stopAtEntry": false
    }]

From my experience the most common problem is an incorrect path the program dll. I would double check that this path actually points to your compiled debug dll. If not, either modify this path or modify the target location of the debug url (this first is easier). Please comment if you have any questions I just worked through this myself.

like image 78
Hamburglar Avatar answered Sep 21 '22 01:09

Hamburglar