-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[CP-stable][ Widget Preview ] Don't crash when directory watcher restarts on Windows #174055
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-stable][ Widget Preview ] Don't crash when directory watcher restarts on Windows #174055
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 handling an exception that occurs when the directory watcher restarts. The fix is implemented by adding an onError handler to the file watcher's event stream, specifically targeting the FileSystemException on Windows. The changes are well-structured, introducing a WatcherBuilder for better testability and updating relevant tests.
My review focuses on improving code maintainability by adding documentation. I've suggested adding doc comments for the new public typedef, fields, and constants to align with the Flutter style guide, which requires all public members to be documented.
|
@bkonyi FYI this was created for you to fill out. |
Thanks for the heads up. Done! |
…0224080e39c25597805b241207
03e97fb
into
flutter:flutter-3.35-candidate.0
…tcher restarts on Windows (flutter/flutter#174055)
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 starteventually 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
WindowsDirectoryWatcherinstance will add an error to the stream with theDirectory watcher closed unexpectedlymessage. TheWindowsDirectoryWatcherrestarts 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 starton Windows for a prolonged period of time.