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>"
}
]
}
Can you please provide the output of dotnet --version?
.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
Also I am seeing in the Debug Console output window the following message
WARNING: Could not load symbols for 'NewCliProject.dll'. 'c:TempNewCliProjectbinDebugdnxcore50win7-x64NewCliProject.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:TempNewCliProject' on host 96532.
[ERROR:OmniSharp.Dnx.DnxPaths] The specified runtime path 'default' does not exist. Searched locations
There are two issues:
Now it is working. thanks for your help.
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"
}
}
}
I'm glad it's working now. Thanks for the additional feedback!
I had the same problem and adding "debugType": "portable" to Project.json obviously solved it although otherwise I have completely different entries
For Visual Studio people searching on this issue:
<PropertyGroup>
<DebugType>portable</DebugType>
</PropertyGroup>
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>
Most helpful comment
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-001661and project.json will be like the following (note that the framework will be netstandardapp1.5):
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},
}