Skip to content
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

Debugger page fails to auto-open main.dart when connected to web app #5350

Closed
elliette opened this issue Mar 3, 2023 · 4 comments
Closed

Comments

@elliette
Copy link
Member

elliette commented Mar 3, 2023

When DevTools is connected to a web app, the debugger page auto-opens the Flutter bootstrap file, instead of the app's main.dart file:

Screenshot 2023-03-03 at 10 44 43 AM

We should make sure the debugger page opens the main.dart file instead of this bootstrap file, which is the intended behavior.

However, there is also the question of discoverability of the file search bar. Instead of loading main.dart, we could default to showing a page that tells the user how to open a file. See dart-lang/webdev#2010

@elliette
Copy link
Member Author

I know why this is happening:

The other option is to have DevTools try to find the main.dart file in the list of scripts, but I don't like that solution and think it should be determined by the VM service / DWDS.

@annagrin
Copy link
Contributor

Unfortunately this is tricky - in dwds we set the rootLib of the VM incorrectly to the wrapper of the main since we don't know what is the correct one. One of the solutions we were thinking about is adding build metadata (constructed by the build, or frontend server in this case) to send all kinds of useful information to dwds (including main module, main module to show in the debugger, locations of dill files, compilation flags etc)

For now we can think of hacking it somehow - if we have an easy way to detect the main module in flutter tools, just pass it as a parameter to dwds? But I am not sure if we do.

I think this should be possible - flutter tools creates a bootstrap to start the main wrapper, is we can find what created the wrapper we can find the main:)

Starting point would be:

https://github.com/flutter/flutter/blob/26b6c1bedda2a62bb0ce84cdd7932769d99f1e52/packages/flutter_tools/lib/src/web/bootstrap.dart#L16

@elliette
Copy link
Member Author

Note: Also investigated how to sort the scripts shown to the user when they open their file search. Started making changes in dart-lang/webdev@master...elliette:sort-scripts, but I think it will also require DevTools changes.

@elliette
Copy link
Member Author

This was fixed in dart-lang/webdev#2047

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants