Fix HostPolicyMock (corehost_error_writer_fn was moved) (#34903)
authorEgor Bogatov <egorbo@gmail.com>
Mon, 13 Apr 2020 20:33:02 +0000 (23:33 +0300)
committerGitHub <noreply@github.com>
Mon, 13 Apr 2020 20:33:02 +0000 (13:33 -0700)
src/coreclr/tests/src/Common/CoreCLRTestLibrary/HostPolicyMock.cs

index 406a70e9e7ababe96d9d17df1218a6b10466bb86..db52f12b08a5de75f264043f10db121afad6be1e 100644 (file)
@@ -31,7 +31,6 @@ namespace TestLibrary
         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 @@ namespace TestLibrary
 
         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(