From af4599f1ec27af4196940458a01e9ffb26c7df5f Mon Sep 17 00:00:00 2001 From: EgorBo Date: Mon, 13 Apr 2020 18:36:54 +0300 Subject: [PATCH] Fix HostPolicyMock (corehost_error_writer_fn was moved) --- .../tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/coreclr/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs b/src/coreclr/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs index 406a70e9e7abab..db52f12b08a5de 100644 --- a/src/coreclr/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs +++ b/src/coreclr/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs @@ -31,7 +31,6 @@ internal delegate void Callback_corehost_resolve_component_dependencies( private static extern void Set_corehost_resolve_component_dependencies_Callback( IntPtr callback); - private static Type _assemblyDependencyResolverType; private static Type _corehost_error_writer_fnType; [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)] @@ -39,12 +38,10 @@ private static extern void Set_corehost_resolve_component_dependencies_Callback( public static void Initialize(string testBasePath, string coreRoot) { - _assemblyDependencyResolverType = typeof(AssemblyDependencyResolver); - // This is needed for marshalling of function pointers to work - requires private access to the ADR unfortunately // Delegate marshalling doesn't support casting delegates to anything but the original type // so we need to use the original type. - _corehost_error_writer_fnType = _assemblyDependencyResolverType.GetNestedType("corehost_error_writer_fn", System.Reflection.BindingFlags.NonPublic); + _corehost_error_writer_fnType = typeof(object).Assembly.GetType("Interop+HostPolicy+corehost_error_writer_fn"); } public static MockValues_corehost_resolve_component_dependencies Mock_corehost_resolve_component_dependencies(