vscode-csharp: Debugging on Windows fails with "Could not load host policy library"

Repro Steps:

At the command line:

  • dotnet new to create new project
  • code . 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

Most upvoted comments

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.