FileSystemWatcher causes user limit exceptions on Kubuntu Linux
Using the following code results in the exception
The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.
The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.
:
public static void Init(string ProjectPath, List <ProjectFile> ProjectFileList, List <ProjectDirectory> ProjectDirList, List <Icon> IconList){ ProjectFiles = ProjectFileList; ProjectDirs = ProjectDirList; Icons = IconList; FSWatcher.BeginInit(); FindItemsInProjectDirectory(null, null); FSWatcher.IncludeSubdirectories = true; FSWatcher.EnableRaisingEvents = true; FSWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; FSWatcher.Changed += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Created += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Deleted += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Renamed += new RenamedEventHandler(FindItemsInProjectDirectory); FSWatcher.Path = ProjectPath; FSWatcher.EndInit();}
public static void Init(string ProjectPath, List <ProjectFile> ProjectFileList, List <ProjectDirectory> ProjectDirList, List <Icon> IconList){ ProjectFiles = ProjectFileList; ProjectDirs = ProjectDirList; Icons = IconList; FSWatcher.BeginInit(); FindItemsInProjectDirectory(null, null); FSWatcher.IncludeSubdirectories = true; FSWatcher.EnableRaisingEvents = true; FSWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; FSWatcher.Changed += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Created += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Deleted += new FileSystemEventHandler(FindItemsInProjectDirectory); FSWatcher.Renamed += new RenamedEventHandler(FindItemsInProjectDirectory); FSWatcher.Path = ProjectPath; FSWatcher.EndInit();}