You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileConfigurationProvider watches all files starting an first existing path; /foo/appsettings.json will listen on all files on the file system #116713
It seems FileConfigurationProvider has some "strange" behavior related to reloadOnChange. I haven't investigated properly, but I have a simple testcase to trigger it.
Looks like it traverse up the filesystem to the first existing folder, and then recursively inotify_add_watch everything it comes across.
So a file like "/doesntexist/appsettings.json" will add every file in the filesystem.
I tested on Linux (GNU Guix System) with net8 and net9.
FileConfigurationSource has the following, which will traverse back to the first existing folder, in the case of /doesntexist/appsettings.json, /.
It thus runs FileProvider = new PhysicalFileProvider("/");.
This in turn creates a file system wather FileSystemWatcher(root), and probably with the recursive flag set.
I guess it recurse down directories it doesn't find in order to detect that the missing directories is created?
Nevertheless, this behavior is problematic when the first existing directory contains a lot of files recursively.
Activity
dotnet-policy-service commentedon Jun 17, 2025
Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Jun 17, 2025
Tagging subscribers to this area: @dotnet/area-extensions-filesystem
See info in area-owners.md if you want to be subscribed.
simendsjo commentedon Jun 17, 2025
FileConfigurationSourcehas the following, which will traverse back to the first existing folder, in the case of/doesntexist/appsettings.json,/.It thus runs
FileProvider = new PhysicalFileProvider("/");.This in turn creates a file system wather
FileSystemWatcher(root), and probably with the recursive flag set.I guess it recurse down directories it doesn't find in order to detect that the missing directories is created?
Nevertheless, this behavior is problematic when the first existing directory contains a lot of files recursively.
Fix PhysicalFilesWatcher: use non-recursive watcher for missing paren…
Add FileConfigurationProvider test: watch token fires when missing pa…
Handle non-existent root directory in PhysicalFilesWatcher (#126411)
Handle non-existent root directory in PhysicalFilesWatcher (#126411)