2007-01-09 Robert Jordan <robertj@gmx.net>
authorRobert Jordan <robertj@gmx.net>
Tue, 9 Jan 2007 22:16:53 +0000 (22:16 -0000)
committerRobert Jordan <robertj@gmx.net>
Tue, 9 Jan 2007 22:16:53 +0000 (22:16 -0000)
* bug-80392.2.cs: Add test for bug #80392.

svn path=/trunk/mono/; revision=70744

mono/tests/ChangeLog
mono/tests/Makefile.am
mono/tests/bug-80392.2.cs [new file with mode: 0644]

index 0789902305bda184ad13c13ceeb9bb5f0746054e..c3447734deaa58d1031b4969348afbf8680aaf8a 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-09  Robert Jordan  <robertj@gmx.net>
+
+       * bug-80392.2.cs: Add test for bug #80392.
+
 2007-01-09  Robert Jordan  <robertj@gmx.net>
 
        * cross-domain.cs: Reflect marshal.c changes: after r70643
index 79d08c7352805fcec16e92c87d1bba7f46c42e3e..294566e96c914b52b7954c448acf309ded4865d3 100644 (file)
@@ -271,7 +271,8 @@ TEST_CS2_SRC = \
        bug-79684.2.cs          \
        catch-generics.2.cs     \
        event-get.2.cs          \
-       safehandle.2.cs
+       safehandle.2.cs         \
+       bug-80392.2.cs
 
 TEST_IL2_SRC = find-method.2.il
 
diff --git a/mono/tests/bug-80392.2.cs b/mono/tests/bug-80392.2.cs
new file mode 100644 (file)
index 0000000..4b85d62
--- /dev/null
@@ -0,0 +1,44 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+
+class Test {
+       delegate int SimpleDelegate (int a);
+
+       static int Method (int a) {
+               return a;
+       }
+
+       static void Callback (IAsyncResult ar)
+       {
+       }
+       
+       static int Main () {
+               SimpleDelegate d1 = new SimpleDelegate (Method);
+               SimpleDelegate d2 = new SimpleDelegate (Method);
+
+               AsyncCallback ac = new AsyncCallback (Callback);
+               
+               IAsyncResult ar1 = d1.BeginInvoke (1, ac, null);
+               IAsyncResult ar2 = d2.BeginInvoke (2, ac, null);
+
+               try {
+                       d1.EndInvoke (ar2);
+                       return 1;
+               } catch (InvalidOperationException) {
+                       // expected
+               }
+
+               try {
+                       d2.EndInvoke (ar1);
+                       return 2;
+               } catch (InvalidOperationException) {
+                       // expected
+               }
+
+               d1.EndInvoke (ar1);
+               d2.EndInvoke (ar2);
+
+               return 0;
+       }
+}