Skip to content

Loading assemblies from root folder / fails on linux arm64 (error code 0x80070002) #109593

@anthony-c-martin

Description

@anthony-c-martin

Description

When using self-contained binaries, we've run into a strange error message if the binary is executed on a path outside of /usr/local/bin. This was reported to us under Azure/bicep#15278.

Here's the error:

./bicep build test.bicep    
Failed to load System.Private.CoreLib.dll (error code 0x80070002)
Path: /System.Private.CoreLib.dll
Error message: Could not load file or assembly '/System.Private.CoreLib.dll'. The system cannot find the file specified.
(0x80070002)

Reproduction Steps

  1. Clone https://github.com/Azure/bicep
  2. Run dotnet publish --configuration release --self-contained true -r linux-arm64 ./src/Bicep.Cli/Bicep.Cli.csproj
  3. Copy the binary to a linux arm64 container, and try to run it from a path outside of /usr/local/bin - e.g. ./bicep build <foo>

Expected behavior

The binary runs successfully and returns exit code 0.

Actual behavior

The following error is returned:

./bicep build test.bicep    
Failed to load System.Private.CoreLib.dll (error code 0x80070002)
Path: /System.Private.CoreLib.dll
Error message: Could not load file or assembly '/System.Private.CoreLib.dll'. The system cannot find the file specified.
(0x80070002)

Regression?

Unknown

Known Workarounds

Copy the binary to /usr/local/bin on the system.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-AssemblyLoader-coreclrin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions