Exceptions in runZonedExperimental's onDone are handled weirdly #12195
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-duplicate
Closed in favor of an existing report
library-async
I expect the following Dart program to crash with an unhandled "Exceptional" Exception.
import "dart:async";
main() {
runZonedExperimental(() {}, onDone: () {
throw new Exception("Exceptional");
});
}
Instead, it crashes on an assertion failure in async/zone.dart:
Unhandled exception:
'dart:async/zone.dart': Failed assertion: line 115 pos 12: '! _children.isEmpty' is not true.
0 _ZoneBase._removeChild (dart:async/zone.dart:115:12)
1 _ZoneBase._dispose (dart:async/zone.dart:48:31)
2 _WaitForCompletionZone._dispose (dart:async/zone.dart:169:19)
3 _ZoneBase._checkIfDone (dart:async/zone.dart:53:15)
4 _ZoneBase._runInZone (dart:async/zone.dart:95:19)
5 _ZoneBase._runUnguarded (dart:async/zone.dart:102:22)
6 _WaitForCompletionZone.runWaitForCompletion (dart:async/zone.dart:166:30)
7 runZonedExperimental (dart:async/zone.dart:262:37)
8 main (test.dart:4:23)
It seems like onDone is not handling exceptions properly.
The text was updated successfully, but these errors were encountered: