File monitoring fails on filesystems that don't support ReadDirectoryChangesW (e.g. VirtualBox shared folders)
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.2k
- PR merge metrics
- PR metrics pending
Description
## Description
On Windows, when a project lives on a filesystem that doesn't support `ReadDirectoryChangesW` (e.g. VirtualBox shared folders using vboxsf), file monitoring fails immediately with:
```
Warning message:
File monitoring failed for project at "X:/path/to/project"
Error 1 (Incorrect function)
Features disabled: R source file indexing, Connect, Diagnostics
```
`ERROR_INVALID_FUNCTION` (1) is returned because the filesystem driver doesn't implement the ioctl that `ReadDirectoryChangesW` relies on. This is distinct from transient errors like `ERROR_NOTIFY_ENUM_DIR` — no amount of retrying will help.
Originally reported as part of #16067 (the Windows portion of that report).
## Possible approach
Fall back to polling-based monitoring when the native API reports an unsupported-filesystem error. The infrastructure for this mostly exists already: `scanFiles` + tree diffing is used for inotify overflow recovery on Linux. A periodic poll using the same mechanism could serve as a fallback when `ReadDirectoryChangesW` fails with `ERROR_INVALID_FUNCTION`.
This is the standard approach in other file watching libraries (chokidar, @parcel/watcher, efsw all fall back to stat polling on unsupported filesystems).
## Affected filesystems
- VirtualBox shared folders (vboxsf)
- Potentially other FUSE/virtual filesystem drivers that don't support change notifications
Contributor guide
Assessment
This issue has not been assessed yet.