Add get_coreclr_command_line which uses hostfxr_initialize_for_dotnet_command_line #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem with
hostfxr_initialize_for_runtime_config
is that the trusted platform assemblies (TPA) will only contain that version's assemblies. If you reference a newer version of a runtime's assembly, the assembly load context will always load the runtime version not your referenced version. There is no way to intercept the loading of this TPA. When creating a dotnet application this does not occur as the runtime is loaded using thehostfxr_initialize_for_dotnet_command_line
method which uses the.runtimeconfig.json
and (importantly).deps.json
. You can then continue to use the runtime as if it was loaded usinghostfxr_initialize_for_runtime_config
.See for details on different ways to initialize https://github.com/dotnet/runtime/blob/main/docs/design/features/native-hosting.md#initializing-host-context