Bug 56842 - System.IO.FIleSystemWatcher rises event on directory with NotifyFilter = NotifyFilters.FileName;
Summary: System.IO.FIleSystemWatcher rises event on directory with NotifyFilter = Noti...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 5.2 (2017-04)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-05-25 16:38 UTC by daniil
Modified: 2017-09-13 18:03 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description daniil 2017-05-25 16:38:22 UTC
Here is sample code which demonstrates the problem:

private static void Main( string[] args )
	FileSystemWatcher _watcher = new FileSystemWatcher( args[ 0 ] )
		InternalBufferSize = 64 * 1024,
		NotifyFilter = NotifyFilters.FileName,
		IncludeSubdirectories = true,
		EnableRaisingEvents = true,

	_watcher.Created += ( o, e )
		=> Console.WriteLine( $"{e.ChangeType} {e.FullPath}" );

	_watcher.Deleted += ( o, e )
		=> Console.WriteLine( $"{e.ChangeType} {e.FullPath}" );

	_watcher.Renamed += ( o, e )
		=> Console.WriteLine( $"{e.ChangeType} {e.FullPath}" );

	_watcher.Error += ( o, e )
		=> Console.WriteLine( $"Error {e.GetException().ToString()}" );

	ManualResetEvent x = new ManualResetEvent( false );

after launch, if i'd create directory using 'mkdir -p' an event would be rised, but it shouldn't.

Mono JIT compiler version 5.0.0 (Stable Thu May 11 14:48:10 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)

Ubuntu 16.04.2 LTS
Comment 1 Marek Safar 2017-09-13 18:03:20 UTC
I cannot reproduce the issue with recent mono (5.4+) on linux or mac