Description
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.
ConfigurationBuilder()
.AddJsonFile(path = "/doesntexist/appsettings.json", optional = true, reloadOnChange = true)
.Build()
inotify_add_watch(55, "/", IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_ONLYDIR|IN_EXCL_UNLINK) = 1
...
lstat("/gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
inotify_add_watch(55, "/gnu", IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_ONLYDIR|IN_DONT_FOLLOW|IN_EXCL_UNLINK) = 2
..
lstat("/gnu/store", {st_mode=S_IFDIR|S_ISVTX|0775, st_size=13279232, ...}) = 0
inotify_add_watch(55, "/gnu/store", IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_ONLYDIR|IN_DONT_FOLLOW|IN_EXCL_UNLINK) = 3
..
lstat("/gnu/store/hbq0irhwfnc0f0gbff8rs1zjq3ljx985-fluidsynth-2.3.1", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
inotify_add_watch(55, "/gnu/store/hbq0irhwfnc0f0gbff8rs1zjq3ljx985-fluidsynth-2.3.1", IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_ONLYDIR|IN_DONT_FOLLOW|IN_EXCL_UNLINK) = 4
Reproduction Steps
ConfigurationBuilder()
.AddJsonFile(path = "/doesntexist/appsettings.json", optional = true, reloadOnChange = true)
.Build()
Expected behavior
It doesn't find the optional file
Actual behavior
It adds inotify watch for every file in the file system
Regression?
No response
Known Workarounds
Check for non-existing paths before adding the json...?
Configuration
net8 and net9 on GNU Guix System (Linux). x86_64.
Other information
No response
Description
It seems
FileConfigurationProviderhas 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_watcheverything 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.
Reproduction Steps
Expected behavior
It doesn't find the optional file
Actual behavior
It adds inotify watch for every file in the file system
Regression?
No response
Known Workarounds
Check for non-existing paths before adding the json...?
Configuration
net8 and net9 on GNU Guix System (Linux). x86_64.
Other information
No response