Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break points are not hit when running the app #82

Closed
tarekgh opened this issue Mar 12, 2016 · 10 comments
Closed

Break points are not hit when running the app #82

tarekgh opened this issue Mar 12, 2016 · 10 comments
Labels

Comments

@tarekgh
Copy link
Member

tarekgh commented Mar 12, 2016

I have followed the exact steps on the page https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger.md. I tried that on Windows and Ubuntu 14.04. when setting a break point on the code and then run the app (using F5), the execution doesn't stop on the break point although the break point is listed in the BREAKPOINTS window. here is all files I have (on Windows) so you may point what is wrong:

NuGet.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

project.json:
{
    "version": "1.0.0-*",
    "compilationOptions": {
        "emitEntryPoint": true,
        "debugType": "portable"
    },

    "dependencies": {
        "NETStandard.Library": "1.0.0-rc3-23829"
    },

    "frameworks": {
        "dnxcore50": { }
    }
}

Program.cs
using System;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // I set the breakpoint on the next line
            Console.WriteLine("Hello World!");
        }
    }
}

tasks.json:
{
    "version": "0.1.0",
    "command": "dotnet",
    "isShellCommand": true,
    "args": [],
    "tasks": [
        {
            "taskName": "build",
            "args": [ ],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        }
    ]
}

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}/bin/Debug/dnxcore50/win7-x64/NewCliProject.exe",
            "args": [],
            "cwd": "${workspaceRoot}",
            "justMyCode": false,
            "stopAtEntry": true
        },
        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}/bin/Debug/<path-to-program>",
            "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"
                }
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processName": "<example>"
        }
    ]
}


@chuckries
Copy link
Contributor

Can you please provide the output of dotnet --version?

@tarekgh
Copy link
Member Author

tarekgh commented Mar 13, 2016

.NET Command Line Tools (1.0.0-beta-001598)

Product Information:
Version: 1.0.0-beta-001598
Commit Sha: 7582649f88

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64

@tarekgh
Copy link
Member Author

tarekgh commented Mar 13, 2016

Also I am seeing in the Debug Console output window the following message

WARNING: Could not load symbols for 'NewCliProject.dll'. 'c:\Temp\NewCliProject\bin\Debug\dnxcore50\win7-x64\NewCliProject.pdb' is a Windows PDB. These are not supported by the cross-platform .NET Core debugger.

I am seeing similar messages for the framework assemblies too. note that I am already using "debugType": "portable" in the project.json which I expect it should support portable pdb.

one more thing, I am seeing the following message when restarting VS Code

[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location 'c:\Temp\NewCliProject' on host 96532.
[ERROR:OmniSharp.Dnx.DnxPaths] The specified runtime path 'default' does not exist. Searched locations

@chuckries
Copy link
Contributor

There are two issues:

  1. The latest version of dotnet cli from here does NOT support portable pdb's on windows. Please see the note under 2. On Windows here. It will point you to a newer dotnet cli that can produce portable pdb's on Windows. Make sure you completely uninstall your current dotnet cli before installing the new one. Then rebuild your project.
  2. The OmniSharp version we’re using still only supports old-style DNX and MSBuild projects. It doesn’t understand newer .NET CLI project.json files. If you want to try out the newer OmniSharp server to get IntelliSense on .NET Core (but breaking compatibility with MSBuild and DNX), do the following:
  3.   Download the appropriate OmniSharp package from https://github.com/OmniSharp/omnisharp-roslyn/releases/tag/v1.9-alpha1.
    
  4.   Unzip/tar it into a folder.
    
  5.   In VS Code, select Code->Preferences->User Settings from the main menu to open settings.json.
    
  6.   In settings.json, add "charp.omnisharp": "path/to/the/omnisharp/executable/I/just/downloaded"
    
  7.   Restart VS Code.
    

@tarekgh
Copy link
Member Author

tarekgh commented Mar 13, 2016

Now it is working. thanks for your help.

@tarekgh tarekgh closed this as completed Mar 13, 2016
@tarekgh
Copy link
Member Author

tarekgh commented Mar 13, 2016

just in case if anyone else run into the same issue, the version of the CLI which worked for me is:

Version: 1.0.0-beta-001661

and project.json will be like the following (note that the framework will be netstandardapp1.5):
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},

"dependencies": {
    "NETStandard.Library": "1.0.0-rc3-23829"
},

"frameworks": {
    "netstandardapp1.5": {
        "imports": "dnxcore50"
    }
}

}

@chuckries
Copy link
Contributor

I'm glad it's working now. Thanks for the additional feedback!

@pemo11
Copy link

pemo11 commented Jan 17, 2017

I had the same problem and adding "debugType": "portable" to Project.json obviously solved it although otherwise I have completely different entries

@bboyle1234
Copy link

For Visual Studio people searching on this issue:

  <PropertyGroup>
    <DebugType>portable</DebugType>
  </PropertyGroup>

@Merlin2001
Copy link

Additional note for Visual Studio people:

Make sure to set @bboyle1234's suggestion here:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    <PlatformTarget>x64</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>

    <DebugType>portable</DebugType>
    
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants