C
C#14mo ago
trev

❔ Issue loading assembly on custom runtime host [Android ARM64]

hey everyone, hopefully im fine to ask this here since it's a pretty specific question i'm trying to port a unity mod loader to android which sets up a .net runtime with a custom rust assembly i've gotten to a point where the c# code does run, but once it's finished, everything crashes i've figured out that it is due to this function call if i remove all the code after that (other than the Ok(()) for error handling), it crashes, but if i comment out that line, it runs fine there isn't a stacktrace from any side, but i attached the logcat/corehost trace just in case the same code works perfectly fine in windows x64 so this is specific to either linux-bionic or arm64
4 Replies
trev
trevOP14mo ago
also as part of my testing, i completely emptied the dll it's loading, so no .net code should be messing it up
No description
trev
trevOP14mo ago
i ended up following the microsoft guide here and rewrote it in rust it seems like the crash is caused by this in step 2 (unless i just did some part of the implementation wrong, which is likely)
rc = get_delegate_fptr(
hostfxr_cxt,
hostfxr_delegate_type::hdt_load_assembly_and_get_function_pointer,
&mut load_assembly_and_get_function_pointer
);
rc = get_delegate_fptr(
hostfxr_cxt,
hostfxr_delegate_type::hdt_load_assembly_and_get_function_pointer,
&mut load_assembly_and_get_function_pointer
);
Write a custom .NET runtime host - .NET
Learn to host the .NET runtime from native code to support advanced scenarios that require controlling how the .NET runtime works.
trev
trevOP14mo ago
after playing around a bit more, it's definitely due to calling hostfxr_get_runtime_delegate, which is especially odd since if i uncomment the rest of the code, it waits until it's done to die
No description
Accord
Accord14mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server