Skip to content

NativeAOT NativeLibrary example crash at runtime #268

@VolodymyrBS

Description

@VolodymyrBS

I have tried to use NativeAOT NativeLibrary example but got an exception at runtime on Windows and WSL:
Windows
Exeption:

Exception thrown: read access violation. this was nullptr.

Stack Trace:
image

Enviroment:
OS Windows 10.0.19041.0
VisualStudio 16.8.0 Preview 5.0
Microsoft.DotNet.ILCompiler 6.0.0-alpha.1.20525.1

WSL:
gdb message:

(gdb) r
Starting program: a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
RuntimeInstance::GetThreadStore (this=0x0) at /__w/1/s/src/coreclr/src/nativeaot/Runtime/RuntimeInstance.cpp:50
50      /__w/1/s/src/coreclr/src/nativeaot/Runtime/RuntimeInstance.cpp: No such file or directory.
(gdb) bt
#0  RuntimeInstance::GetThreadStore (this=0x0) at /__w/1/s/src/coreclr/src/nativeaot/Runtime/RuntimeInstance.cpp:50
#1  0x00007fffff08ddc3 in GetThreadStore () at /__w/1/s/src/coreclr/src/nativeaot/Runtime/threadstore.cpp:40
#2  ThreadStore::AttachCurrentThread (fAcquireThreadStoreLock=true) at /__w/1/s/src/coreclr/src/nativeaot/Runtime/threadstore.cpp:136
#3  0x00007fffff08d650 in Thread::ReversePInvokeAttachOrTrapThread (this=0x409700, pFrame=0x7ffffffedf18) at /__w/1/s/src/coreclr/src/nativeaot/Runtime/thread.cpp:1200
#4  0x00007fffff22f6c6 in NativeLibrary_NativeLibrary_Class1__Add (a=0, b=1) at Class1.cs:11
#5  0x00000000004012b3 in callSumFunc (path=0x402004 "./bin/release/net5.0/linux-x64/native/NativeLibrary.so", funcName=0x402067 "add", firstInt=2, secondInt=8) at LoadLibrary.c:64
#6  0x00000000004011fe in main () at LoadLibrary.c:38

Enviroment:
OS Debian GNU/Linux 10
clang 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
Microsoft.DotNet.ILCompiler 6.0.0-alpha.1.20525.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions