-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Review breakpoint type resolving scope #56301
Comments
Summary: The |
What makes this complicated is that if the type is not in-scope, it could be ambiguous (for example you could have two class C# has something where you can use I think the VM Service's |
Maybe if we could indicate what it should import in some way? |
cc @jensjoha |
Not sure if this is a VM issue, as indicated in comment-2243272766 the client tool would have to build scopes appropriately. |
@DanTup, if you make use of the |
@bkonyi we do use The issue here is not a bug, but a request to try and improve the situation where you have a variable of some type and want to do an I've hit this myself before, and often end up rewriting the expression to be I suspect for the huge majority of cases, "the first class found anywhere with the name Foo" would do just what the user wanted, but ofc that's not very sound (or understandable to the user). I'm not sure (without having some way to reference a type that's not in scope) there's a lot we can do here, but maybe others have ideas? 🤔 |
@DanTup can you share some sample code to help me better understand the context? |
@bkonyi this is a bit contrived, but imagine this code: void main() {
foo(<String>{});
}
void foo(Set s) {
print(s); // Conditional breakpoint here "s is LinkedHashSet"
} If I add a breakpoint to the marked line with the condition While the error is clear (at least for Dart - #56300 makes this really confusing for Flutter, because it just silently doesn't trigger), besides adding an unused import to your code and reloading, there's not a clear way to make the breakpoint trigger when you want. I don't know what a good fix it, but it would be nice if there was a way to fix this, by being able to write an expression like |
Is this a problem if the declaration or import is present in the file? Or is this only a problem with types defined in |
It happens with any type that the declaration is unknown.
No. When this happens, it does work. The following example works for both File import 'c.dart';
void main() {
foo(<String>{});
bar(B());
bar(C());
}
void foo(Set s) {
print(s); // Conditional breakpoint here "s is LinkedHashSet"
}
void bar(A a) {
print(a); // Conditional breakpoint here "a is B" or "a is C"
}
class A {}
class B extends A {} File import 'bug.dart';
class C extends A {} |
Just to be clear, about DanTup comment above:
It should be: For Flutter, currently (until #56300 is resolved) it silently (does) triggers. Which is really weird, it means that for the current state, it behaves strangely. I'll explain this with a Flutter case but any third party package would fit here. Lets say Flutter has a type If I'm debugging my Flutter project and I've created some class Now I go inside that widget declaration to see its current behaviour with my new class instance (that |
My example may have been slightly misleading -
Sorry yes, I got it the wrong way around. That bug results in the condition returning |
Like the following: Currently, it gives an error: Debugger failed to evaluate breakpoint condition "import 'dart:collection'; s is LinkedHashSet": evaluateInFrame: (113) Expression compilation error
org-dartlang-debug:synthetic_debug_expression:1:1: Error: Undefined name 'import'.
import 'dart:collection'; s is LinkedHashSet
^^^^^^
org-dartlang-debug:synthetic_debug_expression:1:8: Error: Expected one expression, but found additional input.
import 'dart:collection'; s is LinkedHashSet
^^^^^^^^^^^^^^^^^ It is not the best possible option, but it would at least make sure that we could run these evaluation tests in breakpoints and such. |
Hello. Please consider #56300.
Now, if this ends up being fixed as non-Flutter Dart, for every type that is not in scope:
I'd like to question here if there could be a way for breakpoint expressions to "ignore" that scope.
Use case:
I have an extension of
FocusNode
, wich is a Flutter (third party/package) class. But as an extended class, some of the logic is done inside Flutter files and they have no way of knowing about my subclass. I'd like to place a breakpoint there and only stop there when my class stops there so I can see if I made anything wrong or I am missing anything. But in my case, allFocusNode
/FocusScope
s in my screen stop there and that makes me have to skip a lot of breaks and hope for me to not missclick on the right one.In this specific case, I can of course do a simple empty wrapper on the exact method I'd like to see and break point there and go inward to see whats going on. Well, two more things here:
Widget
(third party interacting class), I'm not able to do so as well since I would then need to basically rewrite all of the inner workings ofTextFormField
, for example, (which has a lot going on) just to get to theFocus
widgetState
(akaFocusState
).The text was updated successfully, but these errors were encountered: