runtime: Android: PAL_VirtualUnwind failed

Running a .NET Core application on Android, with CoreCLR and CoreFX cross-built for arm64 Android, results in this error message:

LD_LIBRARY_PATH=/data/local/tmp/coredroid/ /data/local/tmp/coredroid/corerun /data/local/tmp/coredroid/helloworld.dll

Assert failure(PID 1306 [0x0000051a], Thread: 1306 [0x051a]): !"Thread::VirtualUnwindToFirstManagedCallFrame: PAL_VirtualUnwind failed"
    File: /home/fcarlier/git/coreclr/src/vm/stackwalk.cpp Line: 770
    Image: /data/local/tmp/coredroid/corerun

Aborted

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 36 (36 by maintainers)

Most upvoted comments

@cydhaselton As I understand it, one of the main issues is type forwarding between assemblies like System.IO.dll and System.Private.CoreLib.dll, and you need to make sure all the assemblies are in sync.

What @janvorli suggests is the best way to do so, as you’re building from coreclr/master and corefx/master.

That said, another possibility is to use the lastest NuGet packages from MyGet. They include the latest versions of most dlls and should reasonably be in sync with System.Private.CoreLib you’re cross building.

For example, I’ve just updated my helloworld.csproj file to use today’s NuGet packages from CoreFX. You should be able to do something like dotnet restore, dotnet publish (this will generate a x64 Linux build), and then update the .csproj file to remove the reference to the ubuntu.16.04-x64 runtime, do a dotnet restore and dotnet build (to get an AnyCPU version of the helloworld.dll assembly). Then, take those files together with your CoreCLR + CoreFX native build and deploy them to Android (so what I talk about in the readme file.

And with that:

LD_LIBRARY_PATH=/data/local/tmp/coredroid/ ./corerun helloworld.dll                         <
Hello World!

Success, .NET Core’s “Hello World” runs on Android!