Questions tagged «tap»

8
为什么不等待Task.WhenAll引发AggregateException?
在此代码中: private async void button1_Click(object sender, EventArgs e) { try { await Task.WhenAll(DoLongThingAsyncEx1(), DoLongThingAsyncEx2()); } catch (Exception ex) { // Expect AggregateException, but got InvalidTimeZoneException } } Task DoLongThingAsyncEx1() { return Task.Run(() => { throw new InvalidTimeZoneException(); }); } Task DoLongThingAsyncEx2() { return Task.Run(() => { throw new InvalidOperation();}); } …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.