Skip to content

Warn before Flutter upgrade on Windows - #9092

Open
LyViolz wants to merge 3 commits into
flutter:mainfrom
LyViolz:fix/windows-flutter-upgrade-warning
Open

LyViolz wants to merge 3 commits into
flutter:mainfrom
LyViolz:fix/windows-flutter-upgrade-warning

Conversation

@LyViolz

@LyViolz LyViolz commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #7668.

On Windows, Flutter SDK files may be locked by IDE processes during an upgrade. This change warns users, recommends closing the IDE and running flutter upgrade in a terminal, and lets them continue from the IDE if they choose. The warning does not assume that every Windows upgrade fails.

Linux and macOS behavior is unchanged.

Testing

  • gradlew.bat compileJava passed on Windows.
  • gradlew.bat test --tests 'io.flutter.actions.*' passed: 12 tests, 0 failures, 0 skipped. This run included a temporary local action harness; the repository's existing action tests also passed.
  • With a locally configured Flutter SDK, the Windows action prompt was exercised: Cancel is the default, and Continue reaches the upgrade action.
  • I did not run flutter upgrade against the local SDK, since that would modify the SDK. The reported Dart SDK file-lock failure itself was not reproduced locally.

@LyViolz
LyViolz requested review from helin24 and pq as code owners August 26, 2026 07:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a warning dialog for Windows users when attempting to upgrade Flutter from within the IDE, as the Dart SDK may be locked by active IDE processes. The review feedback highlights two issues: first, the overridden actionPerformed method in FlutterUpgradeAction needs to report analytics before returning early on Windows to comply with the repository style guide; second, the double single quotes in the newly added properties message should be replaced with single quotes, as the message does not contain format parameters and would otherwise render literally.

Comment thread src/io/flutter/actions/FlutterUpgradeAction.java
Comment thread src/io/flutter/FlutterBundle.properties Outdated
widget.preview.choose_pubroot.title=Select Flutter Project
widget.preview.choose_pubroot.description=Select the Flutter project to use for Flutter Widget Preview.
flutter.upgrade.windows.title=Flutter Upgrade on Windows
flutter.upgrade.windows.message=Flutter upgrades can fail on Windows while the IDE is running because the Dart SDK may be locked by IDE processes. Close the IDE and run ''flutter upgrade'' from a terminal instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

[CONCERN] In IntelliJ properties files, single quotes should only be doubled (''...) if the message contains format parameters (like {0}). Since this message does not contain any parameters, the double single quotes will be rendered literally as double single quotes in the UI. Use single quotes instead.

flutter.upgrade.windows.message=Flutter upgrades can fail on Windows while the IDE is running because the Dart SDK may be locked by IDE processes. Close the IDE and run 'flutter upgrade' from a terminal instead.

@helin24

helin24 commented Aug 27, 2026

Copy link
Copy Markdown
Member

Does this upgrade command always fail on windows? (I am trying to understand if this change is likely to raise complaints from others who are using the upgrade successfully)

The associated issue also mentions that other SDK commands also fail. Are you able to reproduce that as well? If so, we may want this suggestion within the superclass instead of overriding just for upgrade.

@LyViolz

LyViolz commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the clarification.

I haven't been able to reproduce the Windows-specific failure locally, since my development environment is Linux, so I can't confirm that flutter upgrade always fails on Windows or that the other SDK commands mentioned in the issue fail under the same conditions.

My change was based on the issue reports describing Dart SDK files being locked while the IDE is running. Given your concern, I agree that blocking flutter upgrade unconditionally on Windows may be too broad if the command works successfully for some users.

I can revise the approach once we determine whether this is specific to upgrade or applies to SDK commands more generally. If the same locking condition affects multiple commands, handling it in the superclass sounds more appropriate.

@LyViolz
LyViolz force-pushed the fix/windows-flutter-upgrade-warning branch from c811fb6 to 55cf288 Compare September 6, 2026 08:36
@LyViolz

LyViolz commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

I revised the Windows behavior to address the concern about blocking upgrades for users who are not affected. The dialog now recommends closing the IDE and running flutter upgrade in a terminal, while offering a “Continue with upgrade” option; Cancel is the default. Linux and macOS are unchanged, and analytics are reported on both choices.

I have not rerun the Gradle compile or action tests after this update, and I could not verify the Windows behavior locally. The earlier PR test results predate this confirmation-dialog change.

@LyViolz
LyViolz force-pushed the fix/windows-flutter-upgrade-warning branch from 757d890 to ece06d4 Compare September 26, 2026 10:58
@LyViolz
LyViolz force-pushed the fix/windows-flutter-upgrade-warning branch from ece06d4 to f75e851 Compare September 26, 2026 11:00
@LyViolz

LyViolz commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up: I was able to run the checks on the updated head f75e8513 after moving the test workspace and Gradle cache to a drive with sufficient space.

  • gradlew.bat compileJava passed.
  • gradlew.bat test --tests 'io.flutter.actions.*' passed: 10 tests, 0 failures, 0 skipped.

The Windows-specific runtime behavior remains unverified locally.

@LyViolz

LyViolz commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Windows verification update:

  • gradlew.bat compileJava passed.
  • gradlew.bat test --tests 'io.flutter.actions.*' passed: 12 tests, 0 failures, 0 skipped (10 repository action tests plus 2 temporary local action-flow checks).
  • The Windows flow showed the warning with Cancel selected by default; choosing Continue delegated to the upgrade action.

I did not run flutter upgrade against the configured local SDK, since that would modify it, so I have not reproduced the reported Dart SDK directory-lock failure locally. The dialog remains a Windows-only workaround that explains the known IDE/Dart process lock and gives users a choice; it does not claim every Windows upgrade fails.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants