Currently, we can invoke hostfxr in a hosted setup, but only invoke a Program.Main.
I need to host a runtime that I control myself, using coreclrhost.h (here). To do this, I need to know all the information needed to start a runtime.
- The coreclr path so that I can load and invoke it.
- All the properties that were passed to the coreclr. This includes any runtime properties (eg,
System.GC.Server), TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS, etc, etc.
There is already a hostfxr_get_native_search_directories method, but it only returns a piece of the puzzle.
I'd like to create a pull request that adds a hostfxr_get_clr_properties method. This method would return a JSON object (serialized as string) that contains all the info needed to host a coreclr runtime.
This is what I'm thinking for the returned JSON object.
{
"coreclrPath": "/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.1.3/libcoreclr.dylib",
"properties": {
"TRUSTED_PLATFORM_ASSEMBLIES": "...",
"APP_PATHS": "..."
"NATIVE_DLL_SEARCH_DIRECTORIES": "..."
}
}
The properties property would contain every property that is listed here.
With this information, we can self-host a .NET Core runtime with greater control on the lifetime of the runtime and what is done with the runtime.
Maybe I'm totally off base. Maybe there is another way to self-host .NET Core while utilizing deps.json and runtimeconfig.json? I'd love some input before I begin.
Currently, we can invoke hostfxr in a hosted setup, but only invoke a
Program.Main.I need to host a runtime that I control myself, using
coreclrhost.h(here). To do this, I need to know all the information needed to start a runtime.System.GC.Server),TRUSTED_PLATFORM_ASSEMBLIES,APP_PATHS, etc, etc.There is already a
hostfxr_get_native_search_directoriesmethod, but it only returns a piece of the puzzle.I'd like to create a pull request that adds a
hostfxr_get_clr_propertiesmethod. This method would return a JSON object (serialized as string) that contains all the info needed to host a coreclr runtime.This is what I'm thinking for the returned JSON object.
The
propertiesproperty would contain every property that is listed here.With this information, we can self-host a .NET Core runtime with greater control on the lifetime of the runtime and what is done with the runtime.
Maybe I'm totally off base. Maybe there is another way to self-host .NET Core while utilizing deps.json and runtimeconfig.json? I'd love some input before I begin.