dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.88k stars 4.89k forks source link

Failed to initialize CoreCLR, HRESULT: 0x80004005 when starting on CentOS 7.3 #733

Closed fobaz closed 7 years ago

fobaz commented 7 years ago

Latest Visual Studio (2017 version 15.2 (26430.14)), Windows 10 x64 Server CentOS 7.3 x64 Netcore 1.1.2

Developing the app on Windows, it runs fine on Windows. When trying to run the published release build on Linux, it throws this error: Failed to initialize CoreCLR, HRESULT: 0x80004005.

Creation of a new app on Linux and running it works, but I want to build on Windows and host on Linux server.

Any ideas?

Petermarcu commented 7 years ago

How are you running the app and what commands are you using to build it? Are you using dotnet publish?

fobaz commented 7 years ago

Was using Visual Studio publish, now tried dotnet publish with no difference. Running with dotnet /var/www/api/bin/appname.dll Tried adding --fx-version 1.1.2 but didn't make a difference.

Petermarcu commented 7 years ago

That error usually means one of the dependencies isn't there on linux. Did you yum install all the dependency packages? Sounds like you probably did because you said you were able to run the SDK on that Linux machine?

fobaz commented 7 years ago

Yes, I have installed all the dependencies. There is also another app (runtime version 1.1.0) running fine on the server. Just tried right now downgrading this app to 1.1.0, but it did not make a difference. Maybe there is some way to debug to find out what is causing the error?

Petermarcu commented 7 years ago

@gkhanna79 @steveharter isn't there a switch to enable verbose output that will help figure out what it's looking for?

Petermarcu commented 7 years ago

Do you have 1.1.2 installed on the linux machine or use 1.1.0?

fobaz commented 7 years ago

There is /opt/dotnet/shared/Microsoft.NETCore.App/1.1.2 directory, so I guess it's installed. Otherwise, I think, it would throw an error when ran with --fx-version 1.1.2

steveharter commented 7 years ago

To capture verbose output: export COREHOST_TRACE=1

fobaz commented 7 years ago

There are some skips like this:

Processing TPA for deps entry [microsoft.aspnetcore.mvc.dataannotations, 1.1.3, lib/netstandard1.6/Microsoft.AspNetCore.Mvc.DataAnnotations.dll] Considering entry [microsoft.aspnetcore.mvc.dataannotations/1.1.3/lib/netstandard1.6/Microsoft.AspNetCore.Mvc.DataAnnotations.dll] and probe dir [/opt/dotnet/shared/Microsoft.NETCore.App/1.1.2] Skipping... probe in deps json failed Local path query exists /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.DataAnnotations.dll Adding tpa entry: /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.DataAnnotations.dll Processing TPA for deps entry [microsoft.aspnetcore.mvc.formatters.json, 1.1.3, lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Formatters.Json.dll] Considering entry [microsoft.aspnetcore.mvc.formatters.json/1.1.3/lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Formatters.Json.dll] and probe dir [/opt/dotnet/shared/Microsoft.NETCore.App/1.1.2] Skipping... probe in deps json failed Local path query exists /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.Formatters.Json.dll Adding tpa entry: /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.Formatters.Json.dll Processing TPA for deps entry [microsoft.aspnetcore.mvc.localization, 1.1.3, lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Localization.dll] Considering entry [microsoft.aspnetcore.mvc.localization/1.1.3/lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Localization.dll] and probe dir [/opt/dotnet/shared/Microsoft.NETCore.App/1.1.2] Skipping... probe in deps json failed Local path query exists /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.Localization.dll Adding tpa entry: /var/www/ourapp/bin/Microsoft.AspNetCore.Mvc.Localization.dll Processing TPA for deps entry [microsoft.aspnetcore.mvc.razor.host, 1.1.3, lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Razor.Host.dll] Considering entry [microsoft.aspnetcore.mvc.razor.host/1.1.3/lib/netstandard1.6/Microsoft.AspNetCore.Mvc.Razor.Host.dll] and probe dir [/opt/dotnet/shared/Microsoft.NETCore.App/1.1.2] Skipping... probe in deps json failed

I think, they're normal, considering that similar output is in the working app.

The ending of the output:

Property NATIVE_DLL_SEARCH_DIRECTORIES = /opt/dotnet/shared/Microsoft.NETCore.App/1.1.2: Property PLATFORM_RESOURCE_ROOTS = Property AppDomainCompatSwitch = UseLatestBehaviorWhenTFMNotSpecified Property APP_CONTEXT_BASE_DIRECTORY = /var/www/ourapp/bin Property APP_CONTEXT_DEPS_FILES = /var/www/ourapp/bin/OPMtrAPI.deps.json;/opt/dotnet/shared/Microsoft.NETCore.App/1.1.2/Microsoft.NETCore.App.deps.json Property FX_DEPS_FILE = /opt/dotnet/shared/Microsoft.NETCore.App/1.1.2/Microsoft.NETCore.App.deps.json Property JIT_PATH = /opt/dotnet/shared/Microsoft.NETCore.App/1.1.2/libclrjit.so Property System.GC.Server = true Failed to initialize CoreCLR, HRESULT: 0x80004005

On the working app, instead of the failure there is a line like this:

Launch host: /opt/dotnet/dotnet, app: ....

I can't see anything wrong... The installed packages in app:

steveharter commented 7 years ago

From the output, it looks like it is finding the 1.1.2 directory.

Have you tried Centos 7.1? I'm asking as this is what we're testing on.

Did you try a simple "Hello World" assembly (no extra dependencies)? If this still fails, we can try debugging using gdb or I can try a local repro.

fobaz commented 7 years ago

Simple Console app which only prints out "Hello world", created and compiled using VS works fine, however, new WebAPI project fails with the same error. Tried creating new WebAPI project on the server, using dotnet new webapi, but got a few errors when tried to run it:

.assets.json' not found. Run a NuGet package restore to generate this file. Startup.cs(35,16): error CS0518: Predefined type 'System.Void' is not defined or imported and etc.

Maybe upgrading the project to netcore 2 preview would help, as it supports RHEL 7.3? After all, will have to do that sooner or later.

Can't downgrade to Centos 7.1, as it's a production server for other projects.

fobaz commented 7 years ago

After upgradint to netcore 2.0 preview 2, it works, so I guess netcore 1.1.2 doesn't support Centos 7.3 and netcore 2.0 does.

Thanks for the help.