This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 28693 - IOException: kqueue() FileSystemWatcher has reached the maximum nunmber of files to watch.
Summary: IOException: kqueue() FileSystemWatcher has reached the maximum nunmber of fi...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-04-02 11:56 UTC by David Fowler
Modified: 2015-12-17 11:36 UTC (History)
10 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description David Fowler 2015-04-02 11:56:55 UTC
1. Clone ``
2. `cd src\DnxSignoff`
3. `dnu restore`
4. `dnx . kestrel`
5. :(

Expected: Pretty MVC stuff

![screen shot 2015-04-01 at 4 38 13 pm](
Comment 1 Michiel Staessen 2015-04-06 05:11:48 UTC
Also present in MDK 4.0.0
Comment 2 Miguel de Icaza 2015-04-07 18:09:57 UTC
We need a better repro than using dnu restore/dnx kestrel because those stacks are too large and I have failed repeatedly at getting them working with my custom build of Mono.

The resources on the web are also lacking.
Comment 3 Suhas 2015-04-30 14:29:18 UTC
Users are hitting this with 4.0.1 as well. More info at
Comment 4 sornakumar 2015-08-06 14:02:32 UTC
@Miquel de Icaza - This comment mentions the scenario can be repro'd using Gulp and Sass.

Is dnu restore/dnx kestrel still not working for you? I can help you get them working if you give me the error you are encountering..
Comment 5 Chris F Carroll 2015-09-01 18:09:00 UTC
To reproduce this on OS X / Mono 4:
using System;
using System.IO;
public class WatcherFileLimit
    public static void Main()
        FileSystemWatcher watcher = new FileSystemWatcher();
        watcher.Path = "/";
        watcher.EnableRaisingEvents = true;
whereas the equivalent on .Net on Windows 10 (i.e. watcher.Path="\\") works fine.
Comment 6 Chris F Carroll 2015-09-01 18:15:31 UTC
Sorry let me be more precise. That was with mono version 4.2.0.

Reproduce it in the csharp repl with the lines:
using System.IO;
var w= new FileSystemWatcher{Path="/", IncludeSubdirectories=true, EnableRaisingEvents=true};

If you omit EnableRaisingEvents, then it doesn't throw.
Comment 7 Nate Cook 2015-12-04 20:42:52 UTC
I get this using dnx-watch kestrel. Running dnx kestrel works fine.
Comment 8 Nate Cook 2015-12-04 20:51:28 UTC
In my case the workaround was to put my code into a src folder and run dnx-watch there instead of at the root. The result of that was the exclusion of the .git folder in the root, which I assume was the problem since my project is quite small at this point.
Comment 9 Miguel Lira 2015-12-05 11:58:18 UTC
It appears there is hard coded max value of 200 for the number of dictionary entries that can be added to the watcher:

Once exceeded the exception is thrown:

Most .NET 5/MVC 6 developers will run into this limit due to the large number of files added to the bower_components and npm_modules folders.

This is most likely a limit imposed for some performance reason, but it would be great if someone on the Mono team could provide more feedback.
Comment 10 Miguel de Icaza 2015-12-09 00:29:26 UTC
Fixed, the limit is gone.
Comment 11 Shruti 2015-12-17 11:36:09 UTC
I have checked this issue with latest C6SR1 Mono  MonoFramework-MDK- using code snippet given in comment(5) and observed that Now no exception is raising on watcher.EnableRaisingEvents = true. 


Environment Info:

Hence, Closing this issue.

Note You need to log in before you can comment on or make changes to this bug.