}
return;
- } else {
- if (IsGeneral)
- ec.BeginCatchBlock (ec.BuiltinTypes.Object);
- else
- ec.BeginCatchBlock (CatchType);
+ }
- if (li != null) {
- EmitCatchVariableStore (ec);
- } else {
- ec.Emit (OpCodes.Pop);
- }
+ if (IsGeneral)
+ ec.BeginCatchBlock (ec.BuiltinTypes.Object);
+ else
+ ec.BeginCatchBlock (CatchType);
+
+ if (li != null) {
+ EmitCatchVariableStore (ec);
+ } else {
+ ec.Emit (OpCodes.Pop);
}
if (!Block.HasAwait)
{
using (bc.Set (ResolveContext.Options.CatchScope)) {
if (type_expr == null) {
- if (CreateExceptionVariable (bc.Module.Compiler.BuiltinTypes.Object) && Filter != null) {
+ if (CreateExceptionVariable (bc.Module.Compiler.BuiltinTypes.Object)) {
Expression source = new EmptyExpression (li.Type);
assign = new CompilerAssign (new LocalVariableReference (li, Location.Null), source, Location.Null);
Block.AddScopeStatement (new StatementExpression (assign, Location.Null));
{
static int counter;
- public static async Task TestRethrow ()
+ public static async Task TestRethrow (Exception e)
{
try {
- throw new ApplicationException ();
+ throw e;
} catch (ApplicationException) {
Console.WriteLine ("x1a");
counter = 1;
} catch {
counter = 9;
await Task.Delay (1);
+ Console.WriteLine ("ga");
throw;
}
}
public static int Main ()
{
+ var ex = new ApplicationException ();
try {
- TestRethrow ().Wait ();
+ TestRethrow (ex).Wait ();
} catch (AggregateException e) {
- if (!(e.InnerException is ApplicationException))
+ if (e.InnerException != ex)
return 1;
}
if (counter != 3)
return 2;
+ var ex2 = new NotSupportedException ();
+ try {
+ TestRethrow (ex2).Wait ();
+ } catch (AggregateException e) {
+ if (e.InnerException != ex2)
+ return 3;
+ }
+
+ if (counter != 9)
+ return 4;
+
Console.WriteLine ("ok");
return 0;
}
</type>\r
<type name="C+<TestDoubleAwait>c__async1">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>411</size>\r
+ <size>419</size>\r
</method>\r
<method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</test>\r
<test name="test-async-65.cs">\r
<type name="C">\r
- <method name="System.Threading.Tasks.Task TestRethrow()" attrs="150">\r
- <size>33</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
- <size>86</size>\r
+ <size>161</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</type>\r
<type name="C+<TestRethrow>c__async0">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>339</size>\r
+ <size>363</size>\r
</method>\r
<method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Threading.Tasks.Task TestRethrow(System.Exception)" attrs="150">\r
+ <size>41</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-async-66.cs">\r
<type name="TestFinally">\r