1 // This test is meant to make sure Mono doesn't fail when invalid COM invocations are present but never reached.
2 // See https://bugzilla.xamarin.com/show_bug.cgi?id=8477 for details.
5 using System.Runtime.InteropServices;
6 using System.Runtime.CompilerServices;
8 [ComImport, Guid("06A82D35-8946-4E2E-AE71-DADDE8341F5D")]
11 [MethodImpl(MethodImplOptions.InternalCall)] public static extern void InCOMplete1 ();
12 [MethodImpl(MethodImplOptions.InternalCall)] public extern void InCOMplete2 ();
17 static void COMmunicate (COMponent c)
25 // Check #1: An invocation of a ComImport class method w/o a corresponding interface method must lead to an exception.
28 COMponent.InCOMplete1();
29 // No exception has been thrown, something is wrong.
32 catch (InvalidOperationException)
34 // An exception has been thrown and caught correctly.
37 // Check #2: Same as #1, but the method is not executed (i.e. it's located in a "cold" basic block). No exception should be thrown.