From 373163c83c8941f963edb8f487c8a1a02e2016b5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Aug 2026 21:56:23 +0000 Subject: [PATCH 1/3] Clarify assembly-qualified native hosting names Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- docs/core/tutorials/netcore-hosting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tutorials/netcore-hosting.md b/docs/core/tutorials/netcore-hosting.md index af6c95d9e5053..371cec629954d 100644 --- a/docs/core/tutorials/netcore-hosting.md +++ b/docs/core/tutorials/netcore-hosting.md @@ -69,7 +69,7 @@ The `hostfxr_initialize_for_runtime_config` and `hostfxr_get_runtime_delegate` f ### Step 3 - Load managed assembly and get function pointer to a managed method -The runtime delegate is called to load the managed assembly and get a function pointer to a managed method. The delegate requires the assembly path, type name, and method name as inputs and returns a function pointer that can be used to invoke the managed method. +The runtime delegate is called to load the managed assembly and get a function pointer to a managed method. The delegate requires the assembly path, assembly-qualified type name, and method name as inputs and returns a function pointer that can be used to invoke the managed method. Specify the type name in the format `Namespace.TypeName, AssemblyName`. For example, use `MyLibrary.EntryPoint, MyLibrary` for the `EntryPoint` type in the `MyLibrary` assembly. [!code-cpp[HostFxrHost#LoadAndGet](~/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp#LoadAndGet)] @@ -79,7 +79,7 @@ By passing `nullptr` as the delegate type name when calling the runtime delegate public delegate int ComponentEntryPoint(IntPtr args, int sizeBytes); ``` -A different signature can be used by specifying the delegate type name when calling the runtime delegate. +A different signature can be used by specifying an assembly-qualified delegate type name when calling the runtime delegate. Use the same `Namespace.TypeName, AssemblyName` format for the delegate type name. ### Step 4 - Run managed code! From 15baf16da799b7b79b6b1a98301afe78650a7bfc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Aug 2026 06:15:31 +0000 Subject: [PATCH 2/3] Show native host type name Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- docs/core/tutorials/netcore-hosting.md | 4 ++-- .../csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core/tutorials/netcore-hosting.md b/docs/core/tutorials/netcore-hosting.md index 371cec629954d..85299e8503132 100644 --- a/docs/core/tutorials/netcore-hosting.md +++ b/docs/core/tutorials/netcore-hosting.md @@ -69,7 +69,7 @@ The `hostfxr_initialize_for_runtime_config` and `hostfxr_get_runtime_delegate` f ### Step 3 - Load managed assembly and get function pointer to a managed method -The runtime delegate is called to load the managed assembly and get a function pointer to a managed method. The delegate requires the assembly path, assembly-qualified type name, and method name as inputs and returns a function pointer that can be used to invoke the managed method. Specify the type name in the format `Namespace.TypeName, AssemblyName`. For example, use `MyLibrary.EntryPoint, MyLibrary` for the `EntryPoint` type in the `MyLibrary` assembly. +The runtime delegate is called to load the managed assembly and get a function pointer to a managed method. The delegate requires the assembly path, assembly-qualified type name, and method name as inputs and returns a function pointer that can be used to invoke the managed method. [!code-cpp[HostFxrHost#LoadAndGet](~/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp#LoadAndGet)] @@ -79,7 +79,7 @@ By passing `nullptr` as the delegate type name when calling the runtime delegate public delegate int ComponentEntryPoint(IntPtr args, int sizeBytes); ``` -A different signature can be used by specifying an assembly-qualified delegate type name when calling the runtime delegate. Use the same `Namespace.TypeName, AssemblyName` format for the delegate type name. +A different signature can be used by specifying an assembly-qualified delegate type name when calling the runtime delegate. ### Step 4 - Run managed code! diff --git a/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp b/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp index 6dffe1a4b828e..77c87c4e2a4c7 100644 --- a/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp +++ b/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp @@ -92,9 +92,9 @@ int main(int argc, char *argv[]) // STEP 3: Load managed assembly and get function pointer to a managed method // const string_t dotnetlib_path = root_path + STR("DotNetLib.dll"); + // const char_t *dotnet_type = STR("DotNetLib.Lib, DotNetLib"); const char_t *dotnet_type_method = STR("Hello"); - // // Function pointer to managed delegate component_entry_point_fn hello = nullptr; int rc = load_assembly_and_get_function_pointer( From 304316a4296aefa3afab325ec70be8c8b22d5b78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Aug 2026 16:50:42 +0000 Subject: [PATCH 3/3] Include native host assembly path Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp b/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp index 77c87c4e2a4c7..832ab52e49ea8 100644 --- a/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp +++ b/samples/snippets/core/tutorials/netcore-hosting/csharp/HostWithHostFxr/src/NativeHost/nativehost.cpp @@ -91,8 +91,8 @@ int main(int argc, char *argv[]) // // STEP 3: Load managed assembly and get function pointer to a managed method // - const string_t dotnetlib_path = root_path + STR("DotNetLib.dll"); // + const string_t dotnetlib_path = root_path + STR("DotNetLib.dll"); const char_t *dotnet_type = STR("DotNetLib.Lib, DotNetLib"); const char_t *dotnet_type_method = STR("Hello"); // Function pointer to managed delegate