Add host startup hook and tests (dotnet/core-setup#4465)
* Expose coreclr_create_delegate function
* Add startup hook call
Read DOTNET_STARTUP_HOOKS environment variable, and pass it along to a
private function in
System.Private.CoreLib (StartupHookProvider.ProcessStartupHookS).
* Add startup hook tests
* Add some more syntax checks
* Reorder the tests
* Add test for exclamation mark in assembly path
* Fix error behavior for missing methods
MissingMethodException is now only thrown when the Initialize method
doesn't exist at all. This also reorganizes the existing tests for the
invalid signature, and adds some cases.
* Change test behavior to not expect eager file exists check
* Expect full paths for startup hook.
Fixes this in existing tests, and adds a new check for the error
behavior when a relative path is passed.
* Add test for startup hook trace output
* Update tests to use new syntax (without type name)
* Pass STARTUP_HOOKS property key to coreclr_initialize
STARTUP_HOOKS is now passed to the clr during initialization, instead
of using create_delegate in the host. This will allow the clr to call
the startup hooks closer to the execution of the main method, allowing
the threading apartment state to be set based on the main method's
attributes.
* Allow non-public Initialize method
* Remove coreclr::create_delegate
* Add comments clarifying purpose of startup hook test projects
* Add test with ALC assembly resolve event
The startup hook will inject a dependency into the app.
* Fix the ALC startup hook testcase
- Don't set ReferenceOutputAssembly in the projectreference, because
that results in it not being published.
- Dispose the new projects
- Don't throw exceptions from the resolver, since they are swallowed.
Commit migrated from https://github.com/dotnet/core-setup/commit/
841b7e407f6b782b1f5900873f4ffc57875111c6