-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[CP-beta][ Widget Preview ] Don't crash when directory watcher restarts on Windows #174054
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
[CP-beta][ Widget Preview ] Don't crash when directory watcher restarts on Windows #174054
Conversation
…dows (flutter#173987) Fixes flutter#173895 This is a top-10 crasher for `3.35.{0,1}`. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@bkonyi please fill out the PR description above, afterwards the release team will review this request. |
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
There was a problem hiding this comment.
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 addresses a crash on Windows within the widget preview feature by correctly handling a FileSystemException
from the directory watcher. The implementation is solid, introducing dependency injection for Platform
and Watcher
to enhance testability. My feedback is focused on improving documentation by adding comments to new public members, ensuring adherence to the Flutter style guide.
@bkonyi FYI this was created for you to fill out. |
Thanks. Done! |
…24080e39c25597805b241207
025ed8a
into
flutter:flutter-3.36-candidate.0
This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
Issue Link:
What is the link to the issue this cherry-pick is addressing?
#173895
Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See best practices for examples
When running on Windows,
flutter widget-preview start
eventually crashes due to an unhandled exception from the Windows file system watcher that should not be considered fatal.Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Given enough time, the file system watcher backing the
WindowsDirectoryWatcher
instance will add an error to the stream with theDirectory watcher closed unexpectedly
message. TheWindowsDirectoryWatcher
restarts the backing file system watcher, but if the event stream doesn't have an error handler registered, the tool crashes due to the unhandled exception.Workaround:
Is there a workaround for this issue?
No.
Risk:
What is the risk level of this cherry-pick?
Test Coverage:
Are you confident that your fix is well-tested by automated tests?
Validation Steps:
What are the steps to validate that this fix works?
Run
flutter widget-preview start
on Windows for a prolonged period of time.