Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HostPolicyMock (corehost_error_writer_fn was moved) #34903

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,17 @@ 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)]
public delegate void ErrorWriterDelegate(string message);

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(
Expand Down