runtime: CreateAppHost fails on file systems that cannot mmap with MAP_SHARED

I created a new console application in VS 2017 using .NET Core 2.1. Published it as a self-contained linux-x64 app without any changes and tried to run it on an Ubuntu 18.04 VM. Got this error:

 ./LinuxTest 
This executable is not bound to a managed DLL to execute. The binding value is: 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2'
A fatal error was encountered. This executable was not bound to load a managed DLL.

c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 is apparently the SHA256 hash of “foobar”, so whatever the real problem is, this is a very weird error message, too!

LinuxTest.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

</Project>

Program.cs:

using System;

namespace LinuxTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

Resulting self-contained binary: LinuxTest.zip

If I install dotnet-runtime-2.1 on the Linux VM and run dotnet LinuxTest.dll it works.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I’m working on getting a cleaned up version of vboxsf into the mainline linux kernel and that version will have the commit you point to. This project has been on halt for a while, but I actually hope to resume work on it soonish.

@loop-evgeny “depends” was probably too strong a constraint. Fixing #3829 would eliminate the need to search the pattern, and is a better fix than using search/replace via read/write. Please see Nick’s comments above.

,

Is this fixed already? I can’t run a hello world dotnet new webapi with this error, using vagrant with ubuntu… any way to solve this at all? Thx

“error MSB4018: The “CreateAppHost” task failed unexpectedly.”

I had already renamed it. I think my title is more accurate so I renamed it back while keeping CreateAppHost. This is not limited to scenarios involving mapping a windows drive, it can be on any file system on unix that does not allow MAP_SHARED.

I do think https://github.com/dotnet/core-setup/issues/8764 is the best solution.

Re-opening as dotnet/sdk#3427 only fixed part of the issue: deleting the output apphost upon failure so it isn’t left in a semi-customized state.

Seems like it would be safer to just use regular file access - as you say, there will be other filesystems that don’t support memory-mapped files, even if vboxsf eventually does.