[Mono-list] possible bug with FileSystemWatcher

Alex Mac lots.of.mailing.lists at gmail.com
Tue Oct 3 15:51:48 EDT 2006


I'm trying to monitor /dev using the FileSystemWatcher however my app
seems to hang at the point when i call "watcher.IncludeSubdirectories
= true" without that line the code runs fine. Monitoring /tmp with
that option turned on does work...

Also if i try running the code with "MONO_MANAGED_WATCHER=1" then I
get the following error message continuously appearing:

** Message: Unknown errno: Too many levels of symbolic links

FYI I'm running ubuntu edgy with their latest version of mono as of today.

Here is the app:

using System;
using System.IO;

namespace test
{
	public class foo
	{
		public static void delete_handler (object sender, FileSystemEventArgs e)
		{
			Console.WriteLine("delete_handler: " + e.Name + ", " + e.FullPath);
		}
		
		public static void changed_handler (object sender, FileSystemEventArgs e)
		{
			Console.WriteLine("changed_handler: " + e.Name + ", " + e.FullPath);
		}
		
		public static void created_handler (object sender, FileSystemEventArgs e)
		{
			Console.WriteLine("created_handler: " + e.Name + ", " + e.FullPath);
		}
		
		public static void renamed_handler (object sender, RenamedEventArgs e)
		{
			Console.WriteLine("renamed_handler: " + e.Name + ", " + e.FullPath);
		}
		
		public static void Main(string[] args)
		{
			Console.WriteLine("Testing FileSystemWatcher...");
			
			FileSystemWatcher watcher = new FileSystemWatcher("/dev");
			
			watcher.EnableRaisingEvents = true;
			watcher.IncludeSubdirectories = true;
			
			watcher.Deleted += new FileSystemEventHandler(delete_handler);
			watcher.Changed += new FileSystemEventHandler(changed_handler);
			watcher.Created += new FileSystemEventHandler(created_handler);
			watcher.Renamed += new RenamedEventHandler(renamed_handler);

			Console.WriteLine("waiting...");
			Console.ReadLine();
		}
	}
}


More information about the Mono-list mailing list