linux-packaging-mono/mcs/tests/test-async-79.cs
Xamarin Public Jenkins 6992685b86 Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
2015-11-10 14:54:39 +00:00

40 lines
556 B
C#

using System;
using System.Threading.Tasks;
class Test
{
public int in_catch, in_finally;
async Task ExecuteCore ()
{
try {
await Task.Run (() => {
throw new ApplicationException ();
});
} catch (Exception ex) {
++in_catch;
throw;
} finally {
++in_finally;
await Task.Yield ();
}
}
public static int Main ()
{
var t = new Test ();
try {
t.ExecuteCore ().Wait ();
return 3;
} catch (AggregateException) {
}
if (t.in_catch != 1)
return 1;
if (t.in_finally != 1)
return 2;
return 0;
}
}