[Mono-bugs] [Bug 77971][Wis] New - FileSystemWatcher.IncludeSubdirectories not working

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Mar 31 17:03:01 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by cslush at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77971

--- shadow/77971	2006-03-31 17:03:01.000000000 -0500
+++ shadow/77971.tmp.21310	2006-03-31 17:03:01.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 77971
+Product: Mono: Class Libraries
+Version: 1.0
+OS: GNU/Linux [Other]
+OS Details: Linux 2.6.15-gentoo-r7 #10 Sun Mar 26 22:04:58 EST 2006 x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: cslush at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: FileSystemWatcher.IncludeSubdirectories not working
+
+Description of Problem:
+When using the FileSystemWatcher class, the IncludeSubdirectories property
+is not being processed correctly. The following code should be able to
+listen to directories and subdirectories and simply output text to stdout
+if a file is changed. It does not work when IncludeSubdirectories is set to
+TRUE.
+
+Steps to reproduce the problem:
+
+using System;
+using System.IO;
+
+public class FSWatcher
+{
+    public FSWatcher(string path)
+    {
+        FileSystemWatcher watcher = new FileSystemWatcher(path);
+
+        watcher.Changed += new FileSystemEventHandler(OnChanged);
+        watcher.Created += new FileSystemEventHandler(OnChanged);
+        watcher.Deleted += new FileSystemEventHandler(OnChanged);
+
+        watcher.IncludeSubdirectories = true;
+        watcher.EnableRaisingEvents = true;
+
+        while (Console.Read() != 'q');
+    }
+
+    protected static void OnChanged(object source, FileSystemEventArgs e)
+    {
+        Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
+    }
+
+    public static void Main(string[] args)
+    {
+        string path = "";
+
+        if (args.Length > 0)
+        {
+            path = args[0];
+        }
+        else
+        {
+            path = "./";
+        }
+
+        new FSWatcher(path);
+    }
+}
+
+Actual Results:
+Program hangs and nothing is displayed when files are changed.
+
+Expected Results:
+Should output the file change events to the screen.
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+I have gamin installed instead of fam.


More information about the mono-bugs mailing list