[runtime] Unit test for Xamarin-47560
authorEberhard Beilharz <eb1@sil.org>
Fri, 10 Feb 2017 16:24:49 +0000 (17:24 +0100)
committerEberhard Beilharz <eb1@sil.org>
Tue, 8 Aug 2017 21:18:23 +0000 (17:18 -0400)
mono/tests/cominterop.cs
mono/tests/libtest.c

index aecae40401d0b921845a313fde973fe7d126c7cc..4a5bd8fbc6fddfd4f0ac16635bca10ae077060ee 100644 (file)
@@ -251,6 +251,9 @@ public class Tests
        [DllImport ("libtest")]
        public static extern int mono_test_marshal_ccw_itest ([MarshalAs (UnmanagedType.Interface)]ITestPresSig itest);
 
+       [DllImport ("libtest")]
+       public static extern int mono_test_marshal_array_ccw_itest (int count, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex=0)] ITest[] ppUnk);
+
        [DllImport("libtest")]
        public static extern int mono_test_marshal_safearray_out_1dim_vt_bstr_empty ([MarshalAs (UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)]out Array array);
 
@@ -564,6 +567,11 @@ public class Tests
 
                        mono_test_marshal_ccw_itest (test_pres_sig);
 
+                       // test for Xamarin-47560
+                       var tests = new[] { test.Test };
+                       if (mono_test_marshal_array_ccw_itest (1, tests) != 0)
+                               return 201;
+
                        #endregion // COM Callable Wrapper Tests
 
                        #region SAFEARRAY tests
index b94b29d52fd8eae95c11e0877adcc1269a91093d..9950476e4cac4a62f22e18559a11652cc0b2a8d4 100644 (file)
@@ -3581,6 +3581,28 @@ mono_test_marshal_ccw_itest (MonoComObject *pUnk)
        return 0;
 }
 
+// Xamarin-47560
+LIBTEST_API int STDCALL
+mono_test_marshal_array_ccw_itest (int count, MonoComObject ** ppUnk)
+{
+       int hr = 0;
+
+       if (!ppUnk)
+               return 1;
+
+       if (count < 1)
+               return 2;
+
+       if (!ppUnk[0])
+               return 3;
+
+       hr = ppUnk[0]->vtbl->SByteIn (ppUnk[0], -100);
+       if (hr != 0)
+               return 4;
+
+       return 0;
+}
+
 /*
  * mono_method_get_unmanaged_thunk tests
  */