trungnt2910/MemoryModule.NET

Not working with native c# dll.

Closed this issue · 4 comments

Hi c# /net 7/ dll compiled with NativeAOT seems not working.
I got System.AccessViolationException.

Can you provide more details?

Is the MemoryModule.NET itself compiled with NativeAOT, or is the .dll you're trying to load compiled?

Furthermore, you might want to check if the .dll works with the original MemoryModule or provide me with a sample that I can check. Some limitations that apply to the original MemoryModule also applies to MemoryModule.NET, such as the inability to load binaries that uses TLS (thread-local storage).

A stack trace of the exception would also be appreciated.

repro
As You can see I compile C# lib project via Native-AOT and try to load it in other C# console app.

But via Dllimport all works.
I will try to test with original MemoryModule and let You know.

Yes it was TLS (thread-local storage) issue. After compiling using "/Zc:threadSafeInit-" switch all works.