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

Improve messaging when trying to connect to an app in release mode #4273

Closed
johnpryan opened this issue Nov 17, 2022 · 18 comments
Closed

Improve messaging when trying to connect to an app in release mode #4273

johnpryan opened this issue Nov 17, 2022 · 18 comments
Labels
in flutter Relates to running Flutter apps is enhancement relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@johnpryan
Copy link

When an app is running in release mode, and I run the "Open DevTools in Web Browser" command, I get this warning:

Screenshot 2022-11-17 at 12 31 48 PM

Could we detect when the launch configuration's flutterMode is set to release and point users to the documentation?

@DanTup
Copy link
Member

DanTup commented Nov 23, 2022

@johnpryan are you using current stable Flutter? I changed this message in 68cf41f but it requires flutter/flutter#106337 (in theory we might be able to check the mode another way, but since this is already I'm inclined to just wait for it to ship).

I will add a "More info" button that links to those docs though.

@DanTup
Copy link
Member

DanTup commented Nov 23, 2022

@johnpryan can you confirm exactly where we should link to? The link above seems to be related to profile mode, but this issue is only about release mode?

@johnpryan
Copy link
Author

That's a good point, the Flutter performance profiling page isn't quite right because it's also common to use DevTools in Debug mode. I'm not sure we have a place in our docs that says DevTools should only be run in Debug or Profile mode, not Release mode.

@DanTup
Copy link
Member

DanTup commented Nov 23, 2022

Ah, in that case is there anything else to do here? The current message (when running on latest code) says:

DevTools is not available for an app running in this mode.

We could make this more specific (release/profile mode), however it requires making some assumptions in VS Code that I'd rather avoid (there are many ways the user could start the app in profile/release mode that are harder for us to detect).

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Nov 23, 2022
@johnpryan
Copy link
Author

I would prefer if it said "DevTools only supports Debug or Profile mode". The current gives two possible explanations, which can lead to confusion and doesn't tell the user how to resolve the issue.

Is there a way to detect that the debug session isn't ready yet so that we can disambiguate these two scenarios?

@DanTup
Copy link
Member

DanTup commented Nov 23, 2022

I would prefer if it said "DevTools only supports Debug or Profile mode".

Isn't it the case that profile mode for Web doesn't support DevTools (it doesn't have a VM Service)? (see flutter/devtools#3969 (comment)). If so, could it be confusing to say it's only available in debug/profile mode if the user is running a profile (web) build?

Is there a way to detect that the debug session isn't ready yet so that we can disambiguate these two scenarios?

That's what the changes above do. With the latest code (if you're using Flutter master (or beta?)) we will show the new message posted above if we know the debug session has started, and otherwise show the old one (from your screenshot). In a future release, we could drop the "or does not support DevTools" part from that last message so that last message is less vague.

if (session.vmServiceUri) {
return this.devTools.spawnForSession(session as DartDebugSessionInformation & { vmServiceUri: string }, { notify, page });
} else if (session.session.configuration.noDebug) {
vs.window.showInformationMessage("You must start your app with debugging in order to use DevTools.");
} else if (session.hasStarted) {
vs.window.showInformationMessage("DevTools is not available for an app running in this mode.");
} else {
// TODO: Remove the last part of this after the next Flutter release (after 3.0) when the appStarted event
// is passed.
vs.window.showInformationMessage("This debug session is not ready yet or does not support DevTools.");
}

@johnpryan
Copy link
Author

Isn't it the case that profile mode for Web doesn't support DevTools

That's a good point, maybe we could link to a compatibility table in the docs or something...

In a future release, we could drop the "or does not support DevTools"

Sounds good

@johnpryan
Copy link
Author

Related to flutter/devtools#4050

@johnpryan
Copy link
Author

I filed an issue to add a warning about web support flutter/website#7887

@DanTup
Copy link
Member

DanTup commented Nov 30, 2022

That's a good point, maybe we could link to a compatibility table in the docs or something...

Is there an existing one I can link to? If not, if we can add one I can add a "more info" button here to link to it.

@DanTup DanTup added this to the v3.56.0 milestone Nov 30, 2022
@DanTup DanTup added the in flutter Relates to running Flutter apps label Nov 30, 2022
@johnpryan
Copy link
Author

No, I don't think we have a compatibility table in the docs right now.

@DanTup DanTup modified the milestones: v3.56.0, v3.58.0 Dec 19, 2022
@github-actions
Copy link

github-actions bot commented Jan 9, 2023

This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.

@github-actions github-actions bot added the stale Will be closed soon if no response. label Jan 9, 2023
@DanTup DanTup modified the milestones: v3.58.0, v3.60.0 Jan 16, 2023
@DanTup DanTup removed awaiting info Requires more information from the customer to progress stale Will be closed soon if no response. labels Jan 16, 2023
@DanTup
Copy link
Member

DanTup commented Feb 21, 2023

@johnpryan is there still work to do here? We can add a link to the message if there's somewhere appropriate to link to. The text has been tweaked slightly since the issue was originally reported:

} else if (session.session.configuration.noDebug) {
vs.window.showInformationMessage("You must start your app with debugging in order to use DevTools.");
} else if (session.hasStarted) {
vs.window.showInformationMessage("DevTools is not available for an app running in this mode.");
} else {
vs.window.showInformationMessage("This debug session is not ready yet.");
}
}));

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Feb 21, 2023
@johnpryan
Copy link
Author

johnpryan commented Feb 22, 2023

Here's the link to the docs on profile mode, which has a warning about web + profile mode: https://docs.flutter.dev/perf/ui-performance#run-in-profile-mode. It would be great to provide more info about why DevTools is unavailable if we can.

@DanTup
Copy link
Member

DanTup commented Feb 22, 2023

It would be great to provide more info about why DevTools is unavailable if we can.

What sort of explanation would you like to see? I could update flutter_tools to tell us the mode (debug/profile/release) and we could show something like "DevTools is not available for [mode] mode on device [deviceId]" (edit: started here). We would be assuming (from VS Code) that if there is no VM Service that this message is accurate. I don't know if it adds a whole lot over the message above, but it would explicitly show the user what mode is running.

I found this page which lists which part of DevTools are available for each platform:

https://dart.dev/tools/dart-devtools

I wonder if including which modes in this chart would make sense too, and then it would be a good reference to link to?

@DanTup DanTup modified the milestones: v3.60.0, On Deck Feb 27, 2023
@github-actions
Copy link

This issue has been marked stale because it is tagged awaiting-info for 20 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.

@github-actions github-actions bot added the stale Will be closed soon if no response. label Mar 20, 2023
@johnpryan
Copy link
Author

"DevTools is not available for [mode] mode on device [deviceId]" would definitely help here, the table at https://dart.dev/tools/dart-devtools is also handy, but doesn't contain any information about whether the user is in run/profile/release mode

@github-actions github-actions bot removed the stale Will be closed soon if no response. label Mar 22, 2023
DanTup added a commit to DanTup/flutter that referenced this issue Mar 30, 2023
…t to DAP clients

This will allow DAP clients to know the final device ID and also the mode an app is running in (something it currently guesses, but may not be accurate).

May help with Dart-Code/Dart-Code#4273.
@DanTup DanTup removed the awaiting info Requires more information from the customer to progress label Mar 30, 2023
@DanTup DanTup modified the milestones: On Deck, v3.62.0 Mar 30, 2023
@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Mar 30, 2023
@DanTup
Copy link
Member

DanTup commented Mar 30, 2023

Ok, I've updated so it'll look like this:

Screenshot 2023-03-30 at 14 11 36

It requires both flutter/flutter#121239 and a change here in the VS Code extension, so it'll still show the old message until you're using updated versions of each.

I haven't added a link to the page above for now, since it doesn't mention modes - however if it's reasonable for that page to be updated to mention modes, we could easily add a button here.

@DanTup DanTup closed this as completed in c7be875 Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps is enhancement relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

2 participants