41 Commits
Author SHA1 Message Date
Aleksey Kliger (λgeek) 3757a7296c [System] Make FileSystemWatcher backend non-static (#16922)
* [System] Make FileSystemWatcher backend non-static

The FileSystemWatcher `watcher` field is the backend IFileWatcher that's
supposed to be used for the actual operations.

Each backend has a `bool GetInstance (out watcher)` method that returns a
singleton object, so each new instance of FileSystemWatcher gets the same
IFileWatcher instance.  (They will get different `watcher_handle` instances
which are used by some backends to uniquely identify this FileSystemWatcher).

However when the first FileSystemWatcher instance is `Dispose`d, it will set
`watcher = null` which will prevent the remaining instances from calling

    watcher?.StopDispatching (watcher_handle);
    watcher?.Dispose (watcher_handle);

which means that the backend won't properly cleanup resources for any other FSW
instances that have other `watcher_handle` values.

Addresses https://github.com/mono/mono/issues/16709
2019-09-20 11:21:30 -04:00
Maxim Lipnin 12949cf2e6 [wasm] Switch to PNSE version of FileSystemWatcher and exclude xunit tests (#16892)
Fixes https://github.com/mono/mono/issues/16876
2019-09-19 08:13:02 -04:00
Alexis Christoforides 532605f533 [System] Keep events from firing from a disposed 'DefaultWatcher' FileSystemWatcher
Fixes https://github.com/mono/mono/issues/8747

Also try to stop other implementations from dispatching events past Dispose(), without guaranteeing it
2019-07-15 23:25:32 +03:00
Alexis Christoforides 1b163d62d0 [System.IO] Enable CoreFX FilesystemWatcher on Android (#9766)
* [System.IO] Enable CoreFX FilesystemWatcher on Android
This was the last user of the 'InotifyWatcher' Mono implementation, so this is also removed.

* [csproj] Update project files
2018-09-07 23:33:03 -04:00
Alexis Christoforides bc4a1b31c5 [System.IO] Dispatch events asynchronously in FileSystemWatcher.DispatchEvents()
This used to happen in RaiseEvents(), but some CoreFX FSW tests require that a derived FSW be able to fire its event synchronously.
2018-05-30 09:54:02 -04:00
Alexis Christoforides 183d994a91 [System.IO] Finish initializing all FileSystemWatchers, not just the first one
Fixes https://github.com/mono/mono/issues/8712
2018-05-29 16:25:21 -04:00
Marek Safar a801621255 [System] Fixes desktop FSW wildcard pattern to match others implementations 2018-04-12 11:39:27 +02:00
Alexis Christoforides 1e1893d683 [System.IO] Don't throw exception when FileSystemWatcher is disposed while the backend is still trying to use it 2018-03-29 18:25:45 -04:00
Alexander Köplinger cb956b58a6 Revert "Revert "[System.IO] Integrate FileSystemWatchers from CoreFX The FSEvent CoreFX watcher becomes the new default for MacOS.""
This reverts commit 2174a521a3.
2018-02-28 13:42:15 +01:00
Marek Safar 2174a521a3 Revert "[System.IO] Integrate FileSystemWatchers from CoreFX The FSEvent CoreFX watcher becomes the new default for MacOS."
This reverts commit f5b10f34a9.
2018-02-28 12:46:53 +01:00
Alexis Christoforides f5b10f34a9 [System.IO] Integrate FileSystemWatchers from CoreFX
The FSEvent CoreFX watcher becomes the new default for MacOS.
2018-02-28 10:47:01 +01:00
Marek Safar 95b0698304 [System] Clean up some warnings 2016-10-25 14:28:35 +02:00
Alexis Christoforides e79dc945a5 [FileSystemWatcher] Properly handle multicast delegates.
Reverted the async delegate firing which is how Caching et al. expect FSW events; and properly handle the multicast case.

Also fixing a typo/regression in @2f1a136583c90cae805441e63b94bc4f277bb953
2014-12-15 11:05:19 -05:00
Alexis Christoforides 717c6de1cc [System.IO] Phase 2 of revamping KeventWatcher (FileSystemWatcher implementation for OS X/kqueue). Dozens of bugs and reliability issues fixed.
FileSystemWatcher.cs: Fixed multicast events.
SearchPattern.cs :  Fixed issue where case insensitivity was not being honored.
KeventWatcher.cs:
* Fixed several race conditions
* Fixed file descriptor duplication & leaks
* thread-safe/cleaner state transitions for watcher, and much cleaner stopping
* Now uses fsw.Filter parameter and respects IncludeSubdirectories = false. Use fsw.Filter to watch very large trees
* Added more error handling + OnError event
* Lots of behavior/reliability fixes and optimizations for Monitor() loop
* Fixed kevent/timespec struct definitions (for 64-bit build)
2014-10-27 21:20:16 -04:00
Andrés G. Aragoneses 0eb40ad2da Fix very sticky typo in numerous places 2014-01-19 17:51:24 +01:00
Miguel de Icaza f48ceb9860 [System] Removal of the NET_2_0 in the source code
Modulo the GUID in the assembly and the GUID embedded in some
field initializers that use the assembly GUID for their name, the
assemblies are idential before and after the patch.
2012-06-02 13:16:40 -04:00
Marek Habersack 72103eca65 2008-04-17 Marek Habersack <[email protected]>
* FileSystemWatcher.cs: added support for NullFileWatcher. Fixes
	bug #354701

	* NullFileWatcher.cs: added an IFileWatcher implementation which
	does nothing. Selected only by setting the MONO_MANAGED_WATCHER
	environment variable to 'disabled'. Fixes bug #354701

svn path=/trunk/mcs/; revision=100953
2008-04-16 22:31:33 +00:00
Miguel de Icaza f26538eb5f Remove unnecessary TODOs, NIEX
svn path=/trunk/mcs/; revision=88689
2007-11-01 21:42:58 +00:00
Juraj Skripsky c616e7e11b 2007-07-19 Juraj Skripsky <[email protected]>
* FileSystemWatcher.ch (RaiseEvent): Invoke delegate directly, we don't
	need the extra control provided by using GetInvocationList().



svn path=/trunk/mcs/; revision=82295
2007-07-19 15:56:49 +00:00
Sebastien Pouliot 71e6b1a839 2006-11-01 Sebastien Pouliot <[email protected]>
* ErrorEventHandler.cs: Remove [Serializable] in NET_2_0.
	* FileSystemEventHandler.cs: Remove [Serializable] in NET_2_0.
	* FileSystemWatcher.cs: Add missing attributes for NET_2_0.
	* InvalidDataException.cs: Seal class and remove serialization ctor.
	* NotifyFilters.cs: Remove [Serializable] in NET_2_0.
	* RenamedEventHandler.cs: Remove [Serializable] in NET_2_0.
	* WatcherChangeTypes.cs: Remove [Serializable] in NET_2_0.


svn path=/trunk/mcs/; revision=67219
2006-11-01 14:20:11 +00:00
Gonzalo Paniagua Javier be40c48e05 2006-09-05 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: fix file names for the rename event.
	* FileSystemWatcher.cs: ignore exceptions that happen when invoking
	event handlers.


svn path=/trunk/mcs/; revision=64950
2006-09-05 15:38:06 +00:00
Gonzalo Paniagua Javier a25ada1d51 2006-08-16 Gonzalo Paniagua Javier <[email protected]>
* FileSystemWatcher.cs: avoid argument null when we don't know yet the
	target of a rename.


svn path=/trunk/mcs/; revision=63858
2006-08-16 23:02:44 +00:00
Sebastien Pouliot f89c00adf4 2005-07-31 Sebastien Pouliot <[email protected]>
* FileSystemWatcher.cs: Add an EnvironmentPermission assert to read
	environment variable MONO_MANAGED_WATCHER.


svn path=/trunk/mcs/; revision=63177
2006-07-31 13:15:09 +00:00
Gonzalo Paniagua Javier 631ced8da2 2006-07-25 Gonzalo Paniagua Javier <[email protected]>
* FAMWatcher.cs: remove unused method.
	* InotifyWatcher.cs: new watcher supporting inotify directly, as there
	are some distros that do not install 'gamin' anymore. This new watcher
	takes priority over gamin, fam and default.
	* FileSystemWatcher.cs: support for the new watcher.


svn path=/trunk/mcs/; revision=62972
2006-07-25 21:21:33 +00:00
Gonzalo Paniagua Javier 849c9d5112 2005-12-01 Gonzalo Paniagua Javier <[email protected]>
* FAMWatcher.cs: 
	* FileSystemWatcher.cs: use libgamin-1.so.0 instead of libfam.so.0 when
	the runtime finds libgamin. On SUSE libgamin and libfam are not the same
	libraries (on debian, they are just the same and there's no fam-server).


svn path=/trunk/mcs/; revision=53782
2005-12-01 18:50:22 +00:00
Ben Maurer dd19011aa6 locking fixes
svn path=/trunk/mcs/; revision=45088
2005-05-26 23:18:18 +00:00
Geoff Norton 2ede344b8f Patch for bug #62532 implemention of a kqueue/kevent based FileSystemWatcher.
svn path=/trunk/mcs/; revision=32002
2004-08-06 21:42:00 +00:00
Duncan Mak 24f5ef2c44 Add MIT license to System.dll
svn path=/trunk/mcs/; revision=30054
2004-06-21 18:02:11 +00:00
Atsushi Eno 1b9cbdb49e 2004-05-09 Atsushi Enomoto <[email protected]>
* FileSystemWatcher.cs : csc build fix. Duplicate name between class
	  field and local variable. (already filed in bugzilla #47991).

svn path=/trunk/mcs/; revision=26997
2004-05-09 17:10:32 +00:00
Gonzalo Paniagua Javier fec76c733b 2004-05-09 Gonzalo Paniagua Javier <[email protected]>
* DefaultWatcher.cs:
	* FAMWatcher.cs: use MangledFilter instead of Filter.

	* FileSystemWatcher.cs: added MangledFilter and finalizer.

	* SearchPattern.cs: fixed the case when the pattern is "*".

svn path=/trunk/mcs/; revision=26978
2004-05-09 03:31:54 +00:00
Nick Drochak cf5ff95d1b 2004-01-27 Nick Drochak <[email protected]>
* FAMWatcher.cs:
	* FileSystemWatcher.cs: Remove unused variables. Eliminates a couple of
	build warnings.

svn path=/trunk/mcs/; revision=22536
2004-01-27 14:00:08 +00:00
Gonzalo Paniagua Javier 48dbe8fba3 MONO_MANAGED_WATCHER
svn path=/trunk/mcs/; revision=22368
2004-01-22 01:38:13 +00:00
Gonzalo Paniagua Javier 529f2815d7 2004-01-21 Gonzalo Paniagua Javier <[email protected]>
* DefaultWatcher.cs: implemented.
	* FAMWatcher.cs: don't stop the thread when we add a new watch.
	* FileSystemWatcher.cs: on windows we use the default watcher by now.

svn path=/trunk/mcs/; revision=22362
2004-01-21 21:54:45 +00:00
Gonzalo Paniagua Javier dbea39aa46 2004-01-16 Gonzalo Paniagua Javier <[email protected]>
* System.dll.sources: added new files.

	* System_test.dll.sources: added new test.

	* System.IO/DefaultWatcher.cs: stub for the default watcher.
	* System.IO/WindowsWatcher.cs: stub for the windows watcher.

	* System.IO/FAMWatcher.cs: FAM watcher.

	* System.IO/FileAction.cs: enum with event types.

	* System.IO/FileSystemEventArgs.cs: added SetName property.
	* System.IO/FileSystemWatcher.cs: added support for the 3 watchers.

	* System.IO/IFileWatcher.cs: interface implemented by the watchers.
	* System.IO/SearchPattern.cs: copied from corlib.
	* Test/System.IO/FileSystemWatcherTest.cs: new test.

svn path=/trunk/mcs/; revision=22139
2004-01-16 03:27:24 +00:00
Gonzalo Paniagua Javier 0bd1e3df83 Changed line endings
svn path=/trunk/mcs/; revision=22137
2004-01-16 03:04:13 +00:00
Andreas N 832838190c 2003-07-17 Andreas Nahr <[email protected]>
* FileSystemWatcher.cs: Reworked attributes based on the new Consts scheme

svn path=/trunk/mcs/; revision=16338
2003-07-17 11:23:47 +00:00
Andreas N 39c5a38a7b 2003-07-13 Andreas Nahr <[email protected]>
* FileSystemWatcher.cs: Added missing attributes

svn path=/trunk/mcs/; revision=16174
2003-07-13 22:02:25 +00:00
Gonzalo Paniagua Javier 29a0b2e8d7 2003-03-17 Gonzalo Paniagua Javier <[email protected]>
* FileSystemWatcher.cs: added attributes and some more implementation.
	Now only the guts left to do.

	* FileSystemEventArgs.cs:
	* RenamedEventArgs.cs: implemented a couple of properties.

svn path=/trunk/mcs/; revision=12627
2003-03-17 17:36:06 +00:00
Duncan Mak d1eb94eb67 2002-09-15 Duncan Mak <[email protected]>
* FileSystemWatcher.cs (FileSystemWatcher): Fixed the null-param
	constructor.

svn path=/trunk/mcs/; revision=7479
2002-09-15 18:46:41 +00:00
Gonzalo Paniagua Javier 3e02dca4b6 2002-08-28 Gonzalo Paniagua Javier <[email protected]>
* System.ComponentModel/Component.cs:
	* System.ComponentModel/ComponentCollection.cs:
	* System.ComponentModel/Container.cs:
	* System.ComponentModel/MarshalByValueComponent.cs:
	* System.Diagnostics/Process.cs:
	* System.Diagnostics/TextWriterTraceListener.cs:
	* System.IO/FileSystemWatcher.cs:
	IDisposable fixes.

svn path=/trunk/mcs/; revision=7117
2002-08-28 02:30:24 +00:00
Tim Coleman 9915204379 Missed commit of this file previously.
svn path=/trunk/mcs/; revision=6699
2002-08-17 06:29:45 +00:00