You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
44
mcs/tests/test-async-93.cs
Normal file
44
mcs/tests/test-async-93.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Test
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
var t = new Test ();
|
||||
t.Entry().Wait();
|
||||
if (t.caughtCounter != 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int caughtCounter;
|
||||
|
||||
async Task Entry()
|
||||
{
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
try {
|
||||
var result = Func(i);
|
||||
Console.WriteLine($"{i} result {result}");
|
||||
} catch (Exception e) {
|
||||
await Nothing();
|
||||
Console.WriteLine($"{i} caught");
|
||||
++caughtCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Func(int i)
|
||||
{
|
||||
if (i == 0) {
|
||||
throw new Exception();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async Task Nothing()
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user