-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net Core 2.2 console application : System.Private.CoreLib System.ArgumentOutOfRangeException (FileSystemWatcher) #36406
Comments
From @patrick-blanc on Tuesday, May 21, 2019 10:31:29 AM After investigations, we found that problem seems to be related to this commands. .AddJsonFile("appsettings.json", false, true) By settings true for reload on change (that was a mistake done by c/c code), a file system watched is created but not only on the appsettings file. The file system start check the entire files in all folders, subfolders. This produce a memory leak done by the FileSystemWatcher that was taking memory and memory each time a npm install was done by a child process of the console app. To fix it I just set the reloadOnChange to false. It does not create any watcher then and no memory problem at least. .AddJsonFile("appsettings.json", false, false) |
From @JeremyKuhne on Monday, June 3, 2019 9:09:38 PM This should be in https://github.com/aspnet/Extensions. @karelz do you have write access to transfer this or know who does?
|
This is probably due to inlining. Can you clarify what you were doing in the file system when this changed? Were you moving files in or out of the project directory? I do see a possible case where this exception could be thrown but it would only be if a file was moved out of the directory. This is something we should consider hardening for. Basically, my hunch is that if you have a file under the watched directory and then move it outside the watched directory, to a location with a shorter base path, then the |
As part of the migration of components from dotnet/extensions to dotnet/runtime (aspnet/Announcements#411) we will be bulk closing some of the older issues. If you are still interested in having this issue addressed, just comment and the issue will be automatically reactivated (even if you aren't the author). When you do that, I'll page the team to come take a look. If you've moved on or workaround the issue and no longer need this change, just ignore this and the issue will be closed in 7 days. If you know that the issue affects a package that has moved to a different repo, please consider re-opening the issue in that repo. If you're unsure, that's OK, someone from the team can help! |
@patrick-blanc your issue was moved to this repo. Can you please help answer @anurse's questions? |
Paging @dotnet/extensions-migration ! This issue has been revived from staleness. Please take a look and route to the appropriate repository. |
There is some new information about this issue.
|
@patrick-blanc @dlyz I recently fixed a bug in
|
@carlossanlop the gist linked from @dlyz still gives a repro with net5.0 and latest packages. |
Next step is probably to run the repo while logging what runtime/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs Line 253 in d0e2281
is receiving and in what order, specifically the rename events. Perhaps the OS is giving us these events in an unexpected ordering. |
From @patrick-blanc on Thursday, May 16, 2019 1:29:06 PM
Getting unhandled exception from System.Private.CoreLib
My console application (running on windows machine) try to run "npm install" command in different task on different folders.
Sometimes, I get the exception sometimes not. I am not using any FileWatcher in my console application. So my question is why did I get this exception from .net core. Is a .net core console app using by default a file watcher ? Anyone to help me to get rid of that exception.
Here is information from dotnet --info
I see a thread related to same exception on aspnetcore (1 year ago) : #dotnet/aspnetcore#2536
it seems it has been fixed in release 2.0.1 of Microsoft.Extensions.FileProviders.Physical, as I am using .net core 2.2 I don't think it's related. As said before I am not creating any FileWatcher. My code is basically checking if directory exists (like node_modules) if not it run a process (cmd) and run the npm install.
Notice that I find strange that PhysicalFilesWatcher.OnRenamed is throwing an exception on System.String.Substring(Int32 startIndex, Int32 length) because OnRenamed does not use this method but is using System.String.Substring(Int32 startIndex)
Thanks for your help
any hints would be greatly appreciated
Copied from original issue: dotnet/corefx#37707
The text was updated successfully, but these errors were encountered: