question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging on Windows fails with "Could not load host policy library"

See original GitHub issue

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).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
gregg-miskellycommented, Apr 5, 2016

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.

0reactions
MattGertzcommented, Apr 6, 2016

For closure: the (bidirectional) fix for the slash issue was approved for Escrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Could not load host policy library" after updates #5462 - GitHub
Unexpected error writing debug information -- 'Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Cci.
Read more >
Could not load file or assembly or one of its dependencies
Right Click on the Solution name · Click Clean Solution · Restart Visual Studio · Goto project Properties >> Build · Change Configuration...
Read more >
How to resolve “Could not load file or assembly … or one of its ...
fuslogvw.exe is assembly binding log viewer (installed with Visual studio), run it from developers command prompt with admin privileges. Go to debug (under...
Read more >
Error: Unable to Start Debugging on the Web Server
When you try to debug an ASP.NET application running on a Web server, you may get this error message: Unable to start debugging...
Read more >
Setting Up KDNET Network Kernel Debugging Manually
The computer that runs the debugger is called the host computer, and the computer being debugged is called the target computer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found