Omnisharp-vscode: Breakpoint not hitting in VSCode with aspnet - JavaScriptServices (Angular 2 Universal)

Created on 1 Dec 2016  路  8Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
VS Code version: 1.0.0-preview2-003131
C# Extension version: 1.6.0-beta3

Steps to reproduce

Initiate a new .net core project with Angular Universal like mentions here:
https://github.com/aspnet/JavaScriptServices

npm install -g yo generator-aspnetcore-spa
cd some-empty-directory
yo aspnetcore-spa

(Select Angular 2 and enable testing)

Check the template by running this:

dotnet run 

on the command line.

Stop the application (by hitting Ctrl + C) and run it again from VSCode.

Try to add a breakpoint in Views/Shared/_Layout.cshtml for example - the breakpoint gets hit with no problem.

Now try to add a breakpoint in Controllers/HomeController.cs at the

return View();

line here:

public IActionResult Index()
        {
            return View();
        }

Expected behavior

The breakpoint should get hit

Actual behavior

The breakpoint doesn't get hit

Debugger

All 8 comments

@ranbuch Some questions:

  1. What OS are you on?
  2. What does your launch.json look like?
  3. Are breakpoints just broken in your .cshtml file? Or do they not work anywhere in the project?
  1. Windows 10.
  2. 2.
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\creators3d-dot-net-core.dll",
            "args": [],
            "cwd": "${workspaceRoot}",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",
            "launchBrowser": {
                "enabled": true,
                "args": "${auto-detect-url}",
                "windows": {
                    "command": "cmd.exe",
                    "args": "/C start ${auto-detect-url}"
                },
                "osx": {
                    "command": "open"
                },
                "linux": {
                    "command": "xdg-open"
                }
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "sourceFileMap": {
                "/Views": "${workspaceRoot}/Views"
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command.pickProcess}"
        }
    ]
}
  1. Breakpoints works well on my *.cshtml files, but not on my *.cs files.

@ranbuch Do you have portable PDBs enabled? https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs#net-cli-projects-projectjson

@ranbuch were you able to check that out?

@gregg-miskelly The PDBs enabled fixed my problem.

Thank you!

Hi, I am currently running .netcore 1.1 on OSX and having the same problem.

C# Extension Version is 1.7.0

VSCode version: Version 1.10.1 (1.10.1)

Here is my launch.json:

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/WritingBearASP.dll",
            "args": [],
            "cwd": "${workspaceRoot}",
            "stopAtEntry": false,
            "launchBrowser": {
                "enabled": true,
                "args": "${auto-detect-url}",
                "windows": {
                    "command": "cmd.exe",
                    "args": "/C start ${auto-detect-url}"
                },
                "osx": {
                    "command": "open"
                },
                "linux": {
                    "command": "xdg-open"
                }
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": 0
        }
    ]
}

@gregg-miskelly If you could provide some assistance I would be really grateful! Thanks

@stephenyao Can you open a new issue? Please include the following details:

  • Are you seeing module loads in the debug console?
  • If so, are symbols being loaded?
  • What version of OSX are you on?
  • Any other errors/warnings in the debug console?

Hi @gregg-miskelly Thanks for replying, it turns out all I needed to do was change:

"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/WritingBearASP.dll",

to:

"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/WritingBearASP.dll",

Thanks!

Was this page helpful?
0 / 5 - 0 ratings