load_assembly_and_get_function_pointer_fn ptr getting failed
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the native snippet's load_assembly_fn call and the MyDotNetLib.MyClass.Hello declaration. Verify how the assembly path, type name, method name, and returned function pointer are expected to be supplied, then reproduce the 0x80070057 result. Done means the pointer is obtained successfully and the native call reaches Hello.
Written by the indexing model from the issue text.
Description
I am trying to call managed code from native, but load_assembly_and_get_function_pointer_fn getting failed with following error Failed to load assembly or get function pointer. Error code: 0x80070057
code snippet:
const string_t dotnetlib_path = STR("/home/yash/code/nativehost/MyDotNetLib/bin/Debug/net7.0/MyDotNetLib.dll");
const char_t *dotnet_type = STR("MyDotNetLib.MyClass, MyDotNetLib");
const char_t *dotnet_type_method = STR("Hello");
typedef void (*HelloDelegate)();
HelloDelegate hello_delegate = nullptr;
rc = load_assembly_fn(dotnetlib_path.c_str(), dotnet_type, dotnet_type_method, nullptr, nullptr,(void**)&hello_delegate);
if (rc != 0 && hello_delegate == nullptr) {
std::cerr << "Failed to load assembly or get function pointer. Error code: " << std::hex << std::showbase << rc << std::endl;
return false;
Csharp code:
using System; using System.Runtime.InteropServices; namespace MyDotNetLib { public static class MyClass { public static void Hello() { System.Console.WriteLine("hello"); } } }
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 5.1k
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/samples
-
dotnet-target-version
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Race condition in orleans/ShoppingCart/Grains/InventoryGrain.cs#L48Possibly taken @TimonPasslick claimed this 102 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
dotnet-target-version
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
dotnet-target-version
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
VS Code
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AlamoEngine-Tools/pg-starwarsgame-lsp#207 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
elsa-workflows/elsa-core#8593 ·
Maintainers usually reply within 1 day
-
WebSocket upgrade check is case-sensitive for `Upgrade`Possibly taken @S0CloseYetS0Far claimed this today. Openbug good first issue severity:low
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
node: disconnection push notification is logged as "Unknown notification" instead of the disconnect warningPossibly taken @datatrigger claimed this today. Openbug 🐞 Untriaged user issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
valkey-io/valkey-glide#7278 ·
Maintainers usually reply within 2 days