Skip to content

Execution of PublishSingleFile assembly crashes with "Failed to create CoreCLR, HRESULT: 0x80004005" #80017

Description

@LinuxDoku

Description

I can't execute dotnet 7 assemblies which are published with the PublishSingleFile=true flag for win-x64 on my windows 10 x64 workstation.

  • The flag --self-contained is not relevant - error occurs in both cases.
  • It does not matter if I build/publish the assembly directly on this workstation or if I build it on my M1 macbook (with -r win-x64) and copy it over.
  • The assembly itself works on other x64 windows machines - even if it was built on this "defective" workstation.
  • The non PublishSingleFile-executable (in the win-x64, not in the publish directory) can be executed.

I have already repaired dotnet 7 with the installer and restarted this workstation. No luck so far.

Reproduction Steps

dotnet new console -o ConsoleTest
cd ConsoleTest
dotnet publish -c Release -p:PublishSingleFile=true
.\bin\Release\net7.0\win-x64\publish\ConsoleTest.exe

Expected behavior

The application should start, print "Hello, World!" and exit with success status code.

Actual behavior

The application exits with an error:

Failed to create CoreCLR, HRESULT: 0x80004005

COREHOST_TRACE is attached: trace.txt
last lines of this file:

[...]
Adding to native path: C:\Entwicklung\Test\dotnet7\ConsoleTest4\bin\Release\net7.0\win-x64\publish\
Property FX_DEPS_FILE = Property TRUSTED_PLATFORM_ASSEMBLIES = Property NATIVE_DLL_SEARCH_DIRECTORIES = C:\Entwicklung\Test\dotnet7\ConsoleTest4\bin\Release\net7.0\win-x64\publish\;
Property PLATFORM_RESOURCE_ROOTS = Property APP_CONTEXT_BASE_DIRECTORY = C:\Entwicklung\Test\dotnet7\ConsoleTest4\bin\Release\net7.0\win-x64\publish\
Property APP_CONTEXT_DEPS_FILES = Property PROBING_DIRECTORIES = Property RUNTIME_IDENTIFIER = win10-x64
Property System.Reflection.Metadata.MetadataUpdater.IsSupported = false
Property BUNDLE_PROBE = 0x7ff6ab5f5ab0
Property PINVOKE_OVERRIDE = 0x7ff6ab5f5cd0
Property HOSTPOLICY_EMBEDDED = true
CoreCLR path = '', CoreCLR dir = ''
Failed to create CoreCLR, HRESULT: 0x80004005

If required I can hand over a detailed procmon dump.

Regression?

Changing TargetFramework from net7.0 to net6.0 fixes the problem (dotnet 6.0 sdk is also installed).

Known Workarounds

No response

Configuration

dotnet --info
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.101\
Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba
.NET SDKs installed:
5.0.100 [C:\Program Files\dotnet\sdk]
6.0.101 [C:\Program Files\dotnet\sdk]
6.0.300 [C:\Program Files\dotnet\sdk]
7.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
Environment variables:
Not set
global.json file:
Not found

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions