From https://github.com/Dart-Code/Dart-Code/issues/2814 Dart vm runtime crashes when FileSystemWatcher broadcastController onCancel is invoked, that calls unwatchPath, that calls DirectoryWatchHandler::Stop for the DirectoryWatchHandle that seems to be already released(its ref_count is 0, monitor_ is 0):
[Inline Frame] dart.exe!dart::bin::MonitorLocker::MonitorLocker(dart::bin::Monitor * monitor) Line 33
dart.exe!dart::bin::DirectoryWatchHandle::Stop() Line 427
> dart.exe!dart::NativeEntry::AutoScopeNativeCallWrapperNoStackCheck(_Dart_NativeArguments * args, void(*)(_Dart_NativeArguments *) func) Line 218
watching
https://dart-review.googlesource.com/c/sdk/+/169601 with potential fix
https://dart-review.googlesource.com/c/sdk/+/169601 with potential fix
Based on some Windows crash dumps that I was able to share with @aam he sent me an experimental dart SDK with this fix for testing purposes.
And I didn't note a single crash and "Dart Analyzer has terminated" messages during some hours of flutter development today. So this issue seems to be on a good way to be solved.
I still have this issue
Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8874f21e79 (5 days ago) • 2020-10-29 14:14:35 -0700
Engine • revision a1440ca392
Tools • Dart 2.10.3
I still have this issue
Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git ...
The fix mentioned here
https://dart-review.googlesource.com/c/sdk/+/169601 with potential fix
is not yet part of any current flutter channel, not even dev. So we'll have to wait until one of the flutter releases is bundled with at least dart sdk2.12.0-8.0.dev, which seems to be the first to contain it (follow the link to the fix and then click on 'INCLUDED IN').
Most helpful comment
https://dart-review.googlesource.com/c/sdk/+/169601 with potential fix