Allow using active host context in hostfxr_get_runtime_delegate#86460
Allow using active host context in hostfxr_get_runtime_delegate#86460elinor-fung merged 7 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsThese changes allow for passing For testing, I decided to add a new test specifically for ensuring that calling Fixes #84143
|
vitek-karas
left a comment
There was a problem hiding this comment.
Looks good - I'll leave the final call to @elinor-fung .
src/installer/tests/HostActivation.Tests/NativeHosting/HostContext.cs
Outdated
Show resolved
Hide resolved
elinor-fung
left a comment
There was a problem hiding this comment.
Looks good - just some minor comments. Thank you for doing this!
|
I'm going to hazard a guess that the single failure is not really due to my change. I don't see a way of rerunning that one build leg in GH or AzDO (maybe I just don't have permissions). Is there some way to do it without starting an entirely new build? |
|
Yes - they're unrelated. If you go to Checks and then on the left open Build Analysis, it shows that all the failures are known issues. Thanks a lot for this PR! |
|
Thanks, @jander-msft! |
These changes allow for passing
nullptrfor the handle parameter of thehostfxr_get_runtime_delegatefunction. 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. Callinghostfxr_get_runtime_delegatewithout the handle will only work if there is an active host context, otherwise it will returnStatusCode::HostInvalidState.For testing, I decided to add a new test specifically for ensuring that calling
hostfxr_get_runtime_delegatewithout the handle will work instead of updating the existing tests. Most of the other tests would not have worked with this enablement because it requires an active context handle to be set, which only largely occurs if callinghostfxr_get_runtime_delegatewith an existing handle or callingfx_muxer_t::run_app; rather than forcing these to unnecessarily invokehostfxr_get_runtime_delegatetwice (one with a handle, the next without), I created a separate test to do just that.Fixes #84143