-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frame.caller() is broken inside Chain.capture
#111
Comments
Slightly related: The details that we get for In earlier SDKs the
while in
|
Following case could be related: import 'dart:async';
import 'package:stack_trace/stack_trace.dart';
Future<void> main(List<String> arguments) async {
await Chain.capture(() async {
await methodA();
});
}
Future<void> methodA() async {
await methodB();
}
Future<void> methodB() async {
await prepare();
await work();
}
Future<void> prepare() async {}
Future<void> work() async => throw "work error"; Output is following:
As you can see methodA invocation is missing Now if you remove Chain.capture and just run await methodA(); from main, output is like this:
Which is nice and correct trace. Dart version: 2.13.3 (stable) |
I think this is fixed by d3e4c4d and dart-lang/sdk@a52f2b9 |
@mraleph , I just tried with 1.11.1 with latest dart sdk build (as of today: 3.2.0-edge.dd712accf4cb04860dd1ab7a35679e94dc8d6cad (be) (Wed Jul 26 10:58:09 2023 +0000) on "linux_x64") and it still does not solve case I mentioned here: #111 (comment) |
Hmm, indeed stack trace produced by |
The VM started giving us different, significantly truncated
StackTrace
instances when running in the zone forChain.capture
.Frame.caller()
relies on parsingStackTrace.current
which no longer contains the caller we were looking for.Root Cause: dart-lang/sdk#46326
It's possible we could work around this with something like
Chain.current()
instead ofStackTrace.current
, but even with that we'd need to do specific detection that we're in the chain zone and handle the result differently.Inside the
Chain.capture
theChain.current()
looks likeWhile outside of it, it looks like
The text was updated successfully, but these errors were encountered: