diagnostics: Debugging singlefile deployment: Failed to find runtime module (libcoreclr.so), 0x80004005

Steps to repro

$ dotnet new console -n app1; cd app1
$ cat > Program.cs <<EOF
using System;
class Program
{
    static void Main() => throw new Exception("foo");
}
EOF
$ dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true
$ lldb bin/Release/net5.0/linux-x64/publish/app1
(lldb) r
(lldb) clrstack

Expected

Shows the stack trace similar to the one without -p:PublishSingleFile=true, which looks like this:

OS Thread Id: 0x158c (1)
        Child SP               IP Call Site
00007FFFFFFFD4E0 00007ffff6cc0f47 [HelperMethodFrame: 00007fffffffd4e0] 
00007FFFFFFFD650 00007FFF7CF35CF9 Program.Main(System.String[])

Actual

Failed to find runtime module (libcoreclr.so), 0x80004005
Extension commands need it in order to have something to do.
For more information see https://go.microsoft.com/fwlink/?linkid=2135652
ClrStack  failed

Version

$ dotnet sos --version
5.0.152202+4d281c71a14e6226ab0bf0c98687db4a5c4217e3

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.100/

.....

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 38 (38 by maintainers)

Most upvoted comments

I just verified that a single-file app built with SDK version 6.0.100-preview.1.21077.9 works with SOS!

Without this fix I don’t see how SOS could work with a 5.0 built single-file app on Linux. Even if you got SOS to load the DAC (libmscordaccore.so), I see no way for the DAC initialization to work.

Yes, it is not working on Linux. SOS commands like clrstack do not work with lldb path/mysinglefileapp even if we copy libmscordbi.so next to mysinglefileapp.

The single file debugging workaround steps are something like:

  • first use dotnet symbol -d singlefilehost
  • change current working directory to where mysinglefileapp is located (it will not work from any other directory)
  • rename mysinglefileapp to a fixed name: singlefilehost
  • <I don’t remember, but there is more than one files we need to copy including libmscordbi.so>

It worked for JanV at this point, but not on my box.

Nonetheless, it does not look like intentional or acceptable solution.

It looks like the single-file program doesn’t include the export symbol “DotNetRuntimeInfo”

It is a known requirement that has not been implemented yet for single file host. I will look into adding this after finishing current superhost changes