dotnet/runtime · critical

BEGIN: coreclr_execute_assembly failed - Error: 0x%08x

Error message

BEGIN: coreclr_execute_assembly failed - Error: 0x%08x

What it means

Printed by corerun when coreclr_execute_assembly fails to run the managed entry assembly at src/coreclr/hosts/corerun/corerun.cpp:639. Unlike initialization, by this point the runtime is up; failure usually means the assembly path is invalid, the assembly is not a valid managed PE, or the managed entry point threw during early binding/resolution.

Solutions

  1. Confirm the file passed to corerun exists and is a valid managed assembly (run ildasm/dotdump or `file` on it).
  2. Ensure all dependencies are resolvable (place them beside the assembly or set APP_PATHS / TRUSTED_PLATFORM_ASSEMBLIES correctly).
  3. Decode the HRESULT to distinguish FileNotFound/FileLoad from execution-engine failures.
  4. Rebuild the assembly against the same target framework as the loaded runtime.

Example fix

// before
corerun -c /runtimes/unix MyLib.dll
// after
corerun -c /runtimes/unix MyApp.dll  # an app with an entry point
Defensive patterns

Strategy: validation

Validate before calling

// Validate the entry assembly before passing it to corerun
#include <filesystem>
namespace fs = std::filesystem;
bool entry_ok(const fs::path& asm_path) {
    if (!fs::exists(asm_path)) return false;
    // Read DOS+PE header to confirm it is a .NET assembly
    std::ifstream f(asm_path, std::ios::binary);
    unsigned char hdr[0x80];
    f.read(reinterpret_cast<char*>(hdr), sizeof(hdr));
    return hdr[0]==0x4D && hdr[1]==0x5A; // 'MZ'
}

Prevention

When it happens

Trigger: Emitted after coreclr_execute_func returns a FAILED HRESULT. Common causes: entry_assembly_fullpath does not exist or is not a valid .NET assembly, the assembly lacks an entry point, AppDomain assembly resolution fails for a dependency, or the target framework is incompatible with the loaded runtime.

Common situations: Pointing corerun at a native DLL or a .NET Framework assembly while running on CoreCLR, missing a dependency that the assembly references, or a corrupt/truncated assembly file.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/fcb96bfebc5f370a. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/hosts/corerun/corerun.cpp:639

    if (coreclr_set_error_writer_func != nullptr)
    {
        coreclr_set_error_writer_func(nullptr);
    }

    int exit_code;
    {
        actions.before_execute_assembly(config.entry_assembly_fullpath);

        result = coreclr_execute_func(
            CurrentClrInstance,
            CurrentAppDomainId,
            config.entry_assembly_argc,
            argv_utf8.get(),
            entry_assembly_utf8.c_str(),
            (uint32_t*)&exit_code);
        if (FAILED(result))
        {
            pal::fprintf(stderr, W("BEGIN: coreclr_execute_assembly failed - Error: 0x%08x\n"), result);
            logger.dump_details();
            pal::fprintf(stderr, W("END: coreclr_execute_assembly failed - Error: 0x%08x\n"), result);
            return -1;
        }

        actions.after_execute_assembly();
    }

#ifdef TARGET_BROWSER
    // in NodeJS/Browser this is not really end of the process, JS keeps running.
    // We want to keep the CoreCLR runtime alive to be able to process async work
    // The NodeJS process is kept alive by pending async work via safeSetTimeout() -> runtimeKeepalivePush()
    // The actual exit code would be set by SystemJS_ResolveMainPromise if the managed Main() is async.
    // Or in Module.onExit handler when  managed Main() is synchronous.
    return exit_code;
#else // TARGET_BROWSER
    int final_exit_code = corerun_shutdown(exit_code);
#ifdef TARGET_WASI

View on GitHub (pinned to 60108ba66e)