summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-01-18 15:39:54 -0800
committerGitHub <noreply@github.com>2019-01-18 15:39:54 -0800
commit0c6ad4c8d3869b54364b15f21b8b6b5a6fe7a94a (patch)
tree256d6ab0839dfd15a85fb72c02018d06ed541b3e /tests
parent87fb9af12afb29087a818bd588037996a97bf000 (diff)
downloadcoreclr-0c6ad4c8d3869b54364b15f21b8b6b5a6fe7a94a.tar.gz
coreclr-0c6ad4c8d3869b54364b15f21b8b6b5a6fe7a94a.tar.bz2
coreclr-0c6ad4c8d3869b54364b15f21b8b6b5a6fe7a94a.zip
Fix calling conventions on reverse PInvoke callbacks. (#22044)
Diffstat (limited to 'tests')
-rw-r--r--tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs b/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs
index 1c212efd48..ca4d698576 100644
--- a/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs
+++ b/tests/src/Loader/AssemblyDependencyResolverTests/HostPolicyMock.cs
@@ -28,7 +28,7 @@ namespace AssemblyDependencyResolverTests
[DllImport("hostpolicy", CharSet = HostpolicyCharSet)]
private static extern IntPtr Get_corehost_set_error_writer_lastSet_error_writer();
- [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = HostpolicyCharSet)]
+ [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = HostpolicyCharSet)]
internal delegate void Callback_corehost_resolve_component_dependencies(
string component_main_assembly_path);
@@ -39,7 +39,7 @@ namespace AssemblyDependencyResolverTests
private static Type _assemblyDependencyResolverType;
private static Type _corehost_error_writer_fnType;
- [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = HostpolicyCharSet)]
+ [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = HostpolicyCharSet)]
public delegate void ErrorWriterDelegate(string message);
public static string DeleteExistingHostpolicy(string coreRoot)
@@ -88,11 +88,13 @@ namespace AssemblyDependencyResolverTests
internal class MockValues_corehost_resolve_componet_dependencies : IDisposable
{
+ private Callback_corehost_resolve_component_dependencies callback;
+
public Action<string> Callback
{
set
{
- var callback = new Callback_corehost_resolve_component_dependencies(value);
+ callback = new Callback_corehost_resolve_component_dependencies(value);
if (callback != null)
{
Set_corehost_resolve_component_dependencies_Callback(
@@ -113,6 +115,8 @@ namespace AssemblyDependencyResolverTests
string.Empty,
string.Empty);
Set_corehost_resolve_component_dependencies_Callback(IntPtr.Zero);
+ GC.KeepAlive(callback);
+ callback = null;
}
}