dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.37k stars 4.75k forks source link

Failed to locate managed application c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 #109611

Open omajid opened 1 week ago

omajid commented 1 week ago

Description

I am seeing variants of this error on Fedora ELN and CentOS Stream 10, with .NET 8 and .NET 9.

With .NET 8, I see this when building the VMR:

             ILCompiler.Diagnostics -> dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.Diagnostics/x64/Release/ILCompiler.Diagnostics.dll
             ILCompiler.ReadyToRun -> dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/ILCompiler.ReadyToRun/x64/Release/ILCompiler.ReadyToRun.dll
             crossgen2_publish -> dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/crossgen2.dll
             Optimizing assemblies for size. This process might take a while.
             crossgen2_publish -> dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/
             Microsoft.NETCore.App.Crossgen2 -> 
             Failed to locate managed application [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2]
           dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj(67,5): error MSB3073: The command "dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/crossgen2 dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --out dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net8.0/fedora.42-x64/S.P.C.tmp" exited with code 146.

Trying to trace this shows:

COREHOST_TRACE=1 dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/crossgen2 dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --out dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net8.0/fedora.42-x64/S.P.C.tmp
Tracing enabled @ Thu Nov  7 13:41:40 2024 GMT
--- Invoked apphost [version: 8.0.10 @Commit: 81cabf2857a01351e5ab578947c7403a5b128ad1] main = {
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/crossgen2
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll
--out
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net8.0/fedora.42-x64/S.P.C.tmp
}
The managed DLL bound to this executable is: 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2'
Detected Single-File app bundle
Using internal fxr
Invoking fx resolver [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/] hostfxr_main_bundle_startupinfo
Host path: [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/crossgen2]
Dotnet path: [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/]
App path: [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2]
Bundle Header Offset: [99398693]
--- Invoked hostfxr_main_bundle_startupinfo [version: 8.0.10 @Commit: 81cabf2857a01351e5ab578947c7403a5b128ad1]
Mapped application bundle
Unmapped application bundle
Single-File bundle details:
DepsJson Offset:[5ec8f80] Size[24a5]
RuntimeConfigJson Offset:[4f4f5a8] Size[5b4]
.net core 3 compatibility mode: [No]
--- Executing in a native executable mode...
Using dotnet root path [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/]
App runtimeconfig.json from [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2]
Runtime config is cfg=dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.json dev=dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.dev.json
Attempting to read dev runtime config: dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.dev.json
Attempting to read runtime config: dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.json
Mapped bundle for [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.json]
Unmapped application bundle
Runtime config [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.json] is valid=[1]
Executing as a self-contained app as per config file [dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.runtimeconfig.json]
Using internal hostpolicy
Reading from host interface version: [0x16041101:248] to initialize policy version: [0x16041101:248]
Mapped application bundle
Unmapped application bundle
--- Invoked hostpolicy [version: 8.0.10 @Commit: 81cabf2857a01351e5ab578947c7403a5b128ad1] corehost_main = {
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/crossgen2
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll
--out
dotnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Release/net8.0/fedora.42-x64/S.P.C.tmp
}
Mode: apphost
Deps file: 
Managed application [c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2] not found in single-file bundle
Failed to locate managed application [otnet-8.0.10/src/runtime/artifacts/source-build/self/src/artifacts/bin/crossgen2_publish/x64/Release/fedora.42-x64/publish/c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2]

On CentOS Stream 10, the VMR is built successfully, but the produced SDK fails to run with similar symptoms.

Reproduction Steps

On Fedora:

$ fedpkg clone -a dotnet8.0 $ cd dotnet8.0 $ fedpkg --namespace rpms --name dotnet8.0 --release eln mockbuild --no-cleanup-after

Expected behavior

.NET builds

Actual behavior

VMR fails to build, or the generated SDK is broken.

Regression?

Yes.

I don't see this behaviour on Fedora 41, or CentOS Stream 8 or 9.

Known Workarounds

No response

Configuration

$ clang --version clang version 19.1.0 (Fedora 19.1.0-1.eln143) Target: x86_64-redhat-linux-gnu Thread model: posix InstalledDir: /usr/bin Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg

Other information

I had to port https://github.com/dotnet/runtime/pull/109198 first, to build against clang 19. But clang 19 is also used on Fedora 41, and that doesn't show the same issue.

dotnet-policy-service[bot] commented 1 week ago

Tagging subscribers to this area: @vitek-karas, @agocke, @vsadov See info in area-owners.md if you want to be subscribed.

elinor-fung commented 6 days ago

The managed DLL bound to this executable is: 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2'

That is the placeholder that should get replaced by the SDK during build: https://github.com/dotnet/runtime/blob/075b42d9b251ad2d38684c85b7305fbf349630ce/src/native/corehost/corehost.cpp#L39-L40 https://github.com/dotnet/runtime/blob/075b42d9b251ad2d38684c85b7305fbf349630ce/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs#L90-L91

We do explicitly check whether the placeholder value is the same though, so I am confused as to why we don't hit this check: https://github.com/dotnet/runtime/blob/075b42d9b251ad2d38684c85b7305fbf349630ce/src/native/corehost/corehost.cpp#L71-L82

It seems like on those platforms, the crossgen2 executable is somehow (reported as) successfully produced, but without actually updating the placeholder? Do you have a binlog for the build/publish of crossgen2 itself?