Implement AssemblyDependencyResolver (#21896)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Thu, 10 Jan 2019 00:02:36 +0000 (16:02 -0800)
committerGitHub <noreply@github.com>
Thu, 10 Jan 2019 00:02:36 +0000 (16:02 -0800)
commitdbf50d82754a894ba53781dbb839198a46605c9f
tree85e1a320f42be954147e07808bfa0f75edca2180
parentfe5f8d64ae098900eb6bd8b83bf19a7e60e06270
Implement AssemblyDependencyResolver (#21896)

* Implementation of ComponentDependencyResolver

PInvokes into hostpolicy.dll (which should live next to the runtime and thus always be reachable).
If the PInvoke fails (missing hostpolicy.dll) we will fail for now.

Adds tests for the API into CoreCLR repo. The main reason is that with corerun
we can easily mock the hostpolicy.dll since there's none to start with.
Writing the same tests in CoreFX or any other place which starts the runtime through
hostpolicy would require test-only functionality to exist in either the class itself
or in the hostpolicy.

* Fix test project file to work outside of VS

* Better test cleanup to not leave artifacts on disk.

* CDR native resolution tests

 Add native resolution tests

* Implements detailed error reporting for ComponentDependencyResolver.

Registers error writer with the hostpolicy to receive detailed errors. Uses that in the exception.

Modifications to the mock and the tests to be able to verify the functionality.

* Revert overly eager cleanup

* Change public API surface naming to match the approved API surface.

* Fix nits.

* Fix renames.
13 files changed:
src/System.Private.CoreLib/Resources/Strings.resx
src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolver.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/AssemblyDependencyResolverTests.csproj [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/CMakeLists.txt [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/HostpolicyMock.cpp [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/InvalidHostingTest.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/NativeDependencyTests.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/TestBase.cs [new file with mode: 0644]
tests/src/Loader/AssemblyDependencyResolverTests/XPlatformUtils.cs [new file with mode: 0644]