vscode-csharp: Debugging on Windows fails with "Could not load host policy library"
Repro Steps:
- Windows 10
- Install VS Code
- Install latest .NET Core SDK from https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-win-x64.latest.exe
- Install latest C# extension from https://github.com/OmniSharp/omnisharp-vscode/releases/download/v0.3.9/csharp-0.3.9.vsix
At the command line:
dotnet new
to create new projectcode .
to open newly-created project in VS Code
In VS Code:
- Click “Yes” on prompt to add required build and debug assets.
- Open project.json and add
"debugType": "portable"
to"compilationOptions"
section - Open Program.cs and click the margin at line 9 to add a breakpoint on
Console.WriteLine("Hello World!");
Expected Result: Project compiles, runs, and breakpoint is hit.
Actual Result: Project compiles but breakpoint is not hit. Instead, the following text appears in the Debug Console:
Could not load host policy library [c:\Projects] The program ‘c:\Projects\helloworld/bin/Debug/netstandard1.5/helloworld.dll’ has exited with code 131 (0x00000083).
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (14 by maintainers)
Commits related to this issue
- Fix launch on Windows with forward slashes in program (#143) This checkin updates the version of OpenDebugAD7 used by the C# extension to the lastest build. This has a fix for #143. This also update... — committed to gregg-miskelly/vscode-csharp by gregg-miskelly 8 years ago
- Merge pull request #150 from gregg-miskelly/DebuggerLaunchSlashFix Fix launch on Windows with forward slashes in program (#143) — committed to dotnet/vscode-csharp by gregg-miskelly 8 years ago
- Fix launch on Windows with forward slashes in program (#143) This checkin updates the version of OpenDebugAD7 used by the C# extension to the lastest build. This has a fix for #143. This also update... — committed to aeschli/omnisharp-vscode by gregg-miskelly 8 years ago
The issue is that dotnet.exe doesn’t like the fact that the slashes are going the ‘wrong’ way on Windows. You can work around it by modifying your launch.json to replace ‘/’ with ‘\’. I will change our code to do so automatically.