-
Notifications
You must be signed in to change notification settings - Fork 6k
What is an "Assembly qualified delegate type name"? #16646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Where would I find the implementation that corresponds with this header?: |
|
Still interested in the answer to the original question, though. |
I'll ping the author on email. |
Regarding the original question, yes, my understanding is that HostFxr allows specifying a particular overload of a managed method by giving the (assembly-qualified) name of a delegate defining the method signature (as opposed to hosting with CoreClrHost.h, which only looks up managed entry points by method name). You should be able to just provide a string containing the assembly-qualified name of the delegate type matching your entry point's signature (including, perhaps, marshaling attributes). cc'ing @vitek-karas to confirm this, though, because I'm not very experienced with HostFxr. |
So I should be able to invoke this: namespace SamplePrecompiledAssembly {
public static class Startup {
public static Func<object, Task<object>> Func(string code) { // <-- Like this?: returnCode = load_assembly_and_get_function_pointer_fn(loadAssemblyAndGetFunctionPointer)(
assemblyPath.c_str(),
assemblyQualifiedTypeName.c_str(),
methodName.c_str(),
std::string("SamplePrecompiledAssembly.Startup+Func, SamplePrecompiledAssembly").c_str(), // <--
nullptr,
reinterpret_cast<void **>(&run)); |
The string should point to a delegate type, not a method. So something like this should work: namespace SamplePrecompiledAssembly {
public static class Startup {
public delegate Func<object, Task<object>> MyFuncDelegate(string);
public static Func<object, Task<object>> Func(string code) {
}
}
} And then you should be able to use: Note that given this sample it may not work as I don't know how the interop would marshal a |
Hmm, I'm beginning to think this might be a product bug. Steps to Reproduce:
Output on Windows 10:
Output on macOS 10.15 and Ubuntu 18.04:
So it's working on Windows, but not on Mac or Linux. Where would be the appropriate place to pursue this? Since I assume |
I didn't try to run it, but looking at the code there's a difference between Windows and Linux/Mac - when you're calling the The error code is |
I made those fixes and it works now. Thank you very much for your help and patience. |
Does this provide me a way to specify the function signature of the C# method?
What would an example of this parameter look like?
https://github.com/dotnet/samples/blob/master/core/hosting/HostWithHostFxr/src/NativeHost/nativehost.cpp#L104
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: