我尝试调试一个简单的Visual Studio 2017(v15.7.4)生成的dotnet核心控制台应用程序,该应用程序打印一行(“ Hello World”),并且退出并显示错误代码-2147450743(0x80008089) 以下是我收到的全部消息。
'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.1\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[12828] dotnet.exe' has exited with code -2147450743 (0x80008089).
在终端中,我看到消息
Failed to initialize CoreCLR, HRESULT: 0x80070057
但是当我在cmd终端中尝试dotnet run命令时,它可以正确运行,并显示“ Hello World”。
我已经搜索了代码,并得到了错误代码0x80008089
是dotnet/core-setup git repository中CoreClrInitFailure
的
下面是我的环境。
.NET Core SDK(global.json):
Version: 2.1.301
Commit: 59524873d6
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.301\
Host (useful for support):
Version: 2.1.1
Commit: 6985b9f684
.NET Core SDKs installed:
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.301 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
下面是.csproj文件
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
正如@Eric Erhardt所说,在COREHOST_TRACE环境变量设置为1的情况下,尝试了使用dotnet cli效果良好的Visual Studio和不起作用的visual studio。两者都生成完全相同的stderr,除了2行。以下是diff
命令的结果。
$ diff stderr-dotnetcli.txt stderr-vs.txt
3c3
< dotnet
---
> C:\Program Files\dotnet\dotnet.exe
52c52
< dotnet
---
> C:\Program Files\dotnet\dotnet.exe
1453c1453
< HostRID is win10-x64
---
> HostRID is win8-x64
3109,3116c3109
< Launch host: C:\Program Files\dotnet\dotnet.exe, app: C:\Users\user\source\repos\ConsoleApp1\ConsoleApp1\bin\Debug\netcoreapp2.1\ConsoleApp1.dll, argc: 0, args:
< --- Begin breadcrumb write
< Number of breadcrumb files to write is 4
< Breadcrumb thread write callback...
< Breadcrumbs will be written using a background thread
< Hello World!
< Waiting for breadcrumb thread to exit...
< --- End breadcrumb write 1
\ No newline at end of file
---
> Failed to initialize CoreCLR, HRESULT: 0x80070057
\ No newline at end of file