Skip to content

[flutter_tools] Fix PathNotFoundException during native assets cleanup - #190102

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
bkonyi:fix-native-assets-cleanup-crash
Aug 5, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
bkonyi:fix-native-assets-cleanup-crash

Conversation

@bkonyi

@bkonyi bkonyi commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Avoid crashing with a PathNotFoundException if a file is deleted by the OS or another process after being listed but before being deleted by the tool.

Use ErrorHandlingFileSystem.deleteIfExists instead of entity.delete.

Fixes #190234

Avoid crashing with a PathNotFoundException if a file is deleted by the OS or another process after being listed but before being deleted by the tool.

Use ErrorHandlingFileSystem.deleteIfExists instead of entity.delete.
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jul 27, 2026
@bkonyi bkonyi added the CICD Run CI/CD label Aug 4, 2026
@bkonyi
bkonyi marked this pull request as ready for review August 4, 2026 16:34

@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 updates the native assets installation process to use ErrorHandlingFileSystem.deleteIfExists when cleaning up stale files in the target directory, and adds a regression test for this behavior. The review feedback suggests eagerly collecting the directory contents into a list before iterating and deleting to prevent potential FileSystemException issues on Windows.

Comment thread packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart Outdated
@bkonyi
bkonyi requested a review from dcharkes August 5, 2026 14:23

@dcharkes dcharkes 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.

Thanks @bkonyi ! 🙏

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2026
Merged via the queue into flutter:master with commit 7e85c6b Aug 5, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
@bkonyi bkonyi added the cp: stable cherry pick this pull request to stable release candidate branch label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD cp: stable cherry pick this pull request to stable release candidate branch tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flutter_tools] PathNotFoundException during native assets cleanup

2 participants