void TestMe(NonGen g, int limit, bool mustThrow) { try { var z = g.FooAsync(limit); foreach (var i in z.Result) { Console.WriteLine("Result = {0}", i); } if (mustThrow) { throw new Exception("failed to throw"); } } catch (AggregateException ae) { if (!mustThrow) { throw; } } }