Remove allocations from Dns.* (dotnet/corefx#41061)
[mono-project.git] / mono / tests / bug-80392.2.cs
blobad892979deb241cdd9cecdcab76f2bc86f2ecb84
1 using System;
2 using System.Threading;
3 using System.Runtime.InteropServices;
5 class Test {
6 delegate int SimpleDelegate (int a);
8 static int Method (int a) {
9 return a;
12 static void Callback (IAsyncResult ar)
16 static int Main () {
17 SimpleDelegate d1 = new SimpleDelegate (Method);
18 SimpleDelegate d2 = new SimpleDelegate (Method);
20 AsyncCallback ac = new AsyncCallback (Callback);
22 IAsyncResult ar1 = d1.BeginInvoke (1, ac, null);
23 IAsyncResult ar2 = d2.BeginInvoke (2, ac, null);
25 try {
26 d1.EndInvoke (ar2);
27 return 1;
28 } catch (InvalidOperationException) {
29 // expected
32 try {
33 d2.EndInvoke (ar1);
34 return 2;
35 } catch (InvalidOperationException) {
36 // expected
39 if (1 != d1.EndInvoke (ar1)) return 3;
40 if (2 != d2.EndInvoke (ar2)) return 4;
42 return 0;