-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our teststeam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
In WidgetTester.pumpBenchmark, if the calls to either handleBeginFrame or handleDrawFrame throw an exception, the exception is caught and rethrown.
One effect of this is that the whole stack trace from the original throw up to pumpBenchmark gets erased; the only stack trace that's printed is the one from pumpBenchmark outward.
That can make it hard to debug an issue. For example in #150542 (or #148845) the exception output looks like this:
Null check operator used on a null value
#0 WidgetTester.pumpBenchmark (package:flutter_test/src/widget_tester.dart:688)
<asynchronous suspension>
#1 runBuildBenchmark.<anonymous closure> (package:microbenchmarks/stocks/build_bench.dart:48)
[… then more frames out from there …]
There's no null-check operator on that line widget_tester.dart:688 — all it does is:
throw caughtException as Object;So the null-check operator in question could be practically anywhere in the codebase.
I think the main ingredient for fixing this is Error.throwWithStackTrace. That feature was new in Dart 2.16.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our teststeam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team