Repository navigation
Closed
Labels
dotnetAn issue or pull request related to .NETdotnet-pri1.NET 6: important for stable releaseestimate-2wfeatureA feature to be implementediOSIssues affecting iOSmacOSIssues affecting macOS
Milestone
Description
monovm_initialize is a cleaned-up equivalent to coreclr_initialize, which is one of the .NET Core hosting functions in CoreClrHost.h.
It needs to be called in net6 embedding projects before the runtime is started. Specifically, what it's doing is:
- Passing in various runtime properties, a subset of which we support. The important ones are:
TRUSTED_PLATFORM_ASSEMBLIES: Hard-coded list of assemblies, intended to be used for the BCL and fast-path'd in the loading algorithm. They also have some ALC loading implications (default context only).APP_PATHS: Essentially the same asMONO_PATH. PreferTRUSTED_PLATFORM_ASSEMBLIESwhere possible.NATIVE_DLL_SEARCH_DIRECTORIES: Extra directories to check when loading native libraries for pinvokes.System.Globalization.Invariant: Alternative way to set theDOTNET_SYSTEM_GLOBALIZATION_INVARIANTenv var.PINVOKE_OVERRIDE: First-chance native callback to control P/Invoke resolution, see Static linking of native libs runtime#44505
- Adding netcore-specific loader hooks, some of which use those properties
- Setting the runtime to use strict assembly name checking, as we still default to the historical behavior otherwise
The runtime properties are also set in files like .runtimeconfig.json, which is parsed in by the default host and passed to coreclr_initialize. Mono embedders not using the default host will have to handle this themselves, probably at build time in the case of Xamarin, if they wish to support those files.
Applications not calling monovm_initialize may result in a runtime error at some undetermined point in the future.
- PINVOKE_OVERRIDE: [runtime] Redirect to our objc_msgSend wrapper functions when needed for .NET code. #10932.
- TRUSTED_PLATFORM_ASSEMBLIES: [runtime] List all assemblies in TRUSTED_PLATFORM_ASSEMBLIES as pass it to MonoVM/CoreCLR. Fixes #12265. #12272
- APP_PATHS
- NATIVE_DLL_SEARCH_DIRECTORIES: [runtime] Implement computing and passing the NATIVE_DLL_SEARCH_DIRECTORIES runtime property. Fixes #10504. #12309
Time estimate: 2 weeks
Metadata
Metadata
Assignees
Labels
dotnetAn issue or pull request related to .NETdotnet-pri1.NET 6: important for stable releaseestimate-2wfeatureA feature to be implementediOSIssues affecting iOSmacOSIssues affecting macOS
Activity
rolfbjarne commentedon Jan 22, 2021
OK, I'll have a look at this.
Is
monovm_initializealready available to call, or do I have to wait until it's implemented?CoffeeFlux commentedon Jan 22, 2021
Already implemented. It's called by the default dotnet host, so if it didn't work we wouldn't function anywhere.
CoffeeFlux commentedon Jan 22, 2021
The main limitations with it right now are:
lambdageek commentedon Jan 22, 2021
Worth adding,
monovm_intializeis also responsible for surfacing System.AppContext properties from the embedding host through the runtime up to managed https://gist.github.com/lambdageek/c6f101503b6db9876e281e677980b6df[runtime/dotnet] Call coreclr_initialize/monovm_initialize at startup.
[runtime/dotnet] Call coreclr_initialize/monovm_initialize at startup. (
[runtime] Redirect to our objc_msgSend wrapper functions when needed …
[runtime] Redirect to our objc_msgSend wrapper functions when needed …
rolfbjarne commentedon Jul 30, 2021
We're adding all the assemblies in the app bundle to TRUSTED_PLATFORM_ASSEMBLIES, so APP_PATHS shouldn't be needed.
[runtime] Implement computing and passing the NATIVE_DLL_SEARCH_DIREC…
[runtime] Implement computing and passing the NATIVE_DLL_SEARCH_DIREC…