Open natebosch opened 3 years ago
Thanks Nate. I'll have a look.
Bisects to e90967f29de77f58512499acae471a60f9e42761 which made --lazy-async-stacks
default. (My CL)
One thing I notice is that it seems to be a behavioural change specific to StackTrace.current
as:
Future<void> callee() async { ...; throw 'callee throws!'; }
await Chain.capture(() async { ... }, onError: (e, sc) { print("$e:\n$sc"); });
produces:
callee throws!
dart_46326.dart 9:5 main.callee
===== asynchronous gap ===========================
dart:async/zone.dart 1364:19 _CustomZone.registerBinaryCallback
dart:async-patch/async_patch.dart 61:8 _asyncErrorWrapperHelper
dart_46326.dart main.<fn>
package:stack_trace/src/chain.dart 94:24 Chain.capture.<fn>
dart:async/zone.dart 1428:13 _rootRun
dart:async/zone.dart 1328:19 _CustomZone.run
dart:async/zone.dart 1863:10 _runZoned
dart:async/zone.dart 1785:10 runZoned
package:stack_trace/src/chain.dart 92:12 Chain.capture
dart_46326.dart 17:15 main
dart:isolate-patch/isolate_patch.dart 283:19 _delayEntrypointInvocation.<fn>
dart:isolate-patch/isolate_patch.dart 184:12 _RawReceivePortImpl._handleMessage
which I believe is what you were expecting.
I'll dive into where that difference comes from and what the expected output of StackTrace.current
is for this case.
@natebosch If you use Chain.capture(), could you then also use Chain.current() instead of StackTrace.current
? Would that fix your issue?
@natebosch If you use Chain.capture(), could you then also use Chain.current() instead of
StackTrace.current
? Would that fix your issue?
I suspect we could fix it that way. I haven't dug to find how challenging it might be, but it's the first option I describe in https://github.com/dart-lang/stack_trace/issues/111
Hello here, any progress on this?
Somewhere between
2.12.0-13.0.dev
and2.12.0-29.0.dev
there was a regression inStackTrace.current
when used within the zone for aChain.capture
call.Reproduction is using
package:stack_trace
.Running with
2.12.0-13.0.dev
and earlier SDKs outputs a meaningful stacktrace:Running with
2.12.0-29.dev
and later SDKs outputs instead:The closure it references should be this one:
https://github.com/dart-lang/stacK_trace/blob/4755bcf8ab0258212f4767218fdeb8429f3e550e/lib/src/stack_zone_specification.dart#L126
cc @cskau-g