Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I got an unhandled NullReferenceException in mcs/class/System/System.IO/DefaultWatcher.cs at line 221 -- "files" was null. All the places that "files" gets set can't be null, except for the one on line 204, a call to Directory.GetFileSystemEntries(). That led to mcs/class/corlib/System.IO/Directory.cs line 497, which led to mcs/class/corlib/System.IO/MonoIO.cs line 177, which led to a C function called ves_icall_System_IO_MonoIO_GetFileSystemEntries(), which starts at line 319 of mono/metadata/file-io.c . That function can return NULL in several different ways.
Looking around, this seems to be a general problem...
Files that call GetFileSystemEntries() and check for null:
Files that call GetFileSystemEntries() without checking for null:
Files with a GetFileSystemEntries() that can return null:
If fixing this is as simple as adding null checks to the affected areas, I can crank that out and submit a patch. Otherwise, someone more knowledgeable than me needs to look into this.
Created attachment 2063 [details]
My patch for the problem
As far as I can tell, the problem is that ves_icall_System_IO_MonoIO_GetFileSystemEntries() can return null without setting an error.
The following patch is my suggestion for fixing the problem.
I've submitted this patch to the mono-devel mailing list, but have gotten no reply.
Thanks for the patch, applied!