Allow using active host context in hostfxr_get_runtime_delegate (#86460)
authorJustin Anderson <jander-msft@users.noreply.github.com>
Sat, 20 May 2023 07:45:57 +0000 (00:45 -0700)
committerGitHub <noreply@github.com>
Sat, 20 May 2023 07:45:57 +0000 (09:45 +0200)
commit408729ca215ef5e9ff5127d878b042c4ff3849e9
tree0fa4910b83ccacdf34554cd82da3aa084b4f44c1
parent09399050c82b0ff2e9b082c36524f39a1e3ad6c1
Allow using active host context in hostfxr_get_runtime_delegate (#86460)

These changes allow for passing `nullptr` for the handle parameter of the `hostfxr_get_runtime_delegate` function. This allows in-process callers who do not have the real host context handle to invoke this function and get a runtime delegate for the primary runtime instance. Calling hostfxr_get_runtime_delegate without the handle will only work if there is an active host context, otherwise it will return StatusCode::HostInvalidState.
src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs
src/native/corehost/fxr/fx_muxer.cpp
src/native/corehost/fxr/fx_muxer.h
src/native/corehost/fxr/hostfxr.cpp
src/native/corehost/test/nativehost/host_context_test.cpp
src/native/corehost/test/nativehost/host_context_test.h
src/native/corehost/test/nativehost/nativehost.cpp