Debugging on Windows fails with "Could not load host policy library"
See original GitHub issueRepro 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).
Issue Analytics
- State:
- Created 7 years ago
- Comments:21 (14 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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.
For closure: the (bidirectional) fix for the slash issue was approved for Escrow.