[Mono-list] FileSystemWatcher events do not fire

Andrus eetasoft at online.ee
Mon Jun 25 07:43:45 EDT 2007


I found that FileSystemWatcher  events does not occur.
Same code in .NET runs OK.
How to fix ?

Andrus.

To reproduce, run code.

Expected: message box should appear

Observed: message box does not appear.

Enironment:

MONO 1.2.4 .Net 2 profile
Windows XP

Code to reproduce:

using System;
using System.Windows.Forms;
using System.IO;

class main {
 [STAThreadAttribute()]
 public static void Main() {

  File.Delete("c:\\test");
  FileSystemWatcher watch = new FileSystemWatcher();
   watch.Path = "c:\\";
   watch.Filter = "test";
   watch.Created += OnChanged;
   watch.Deleted += OnChanged;
   watch.Changed += OnChanged;
   watch.EnableRaisingEvents = true;

  FileStream oFs = new FileStream("c:\\test", 
FileMode.CreateNew, FileAccess.ReadWrite);
  StreamWriter oWriter = new StreamWriter(oFs);
  oWriter.Flush();
  oWriter.Close();
  oFs.Close();
  File.Delete("c:\\test");
  Application.Run(new Form());
 }

 static void OnChanged(object sender, FileSystemEventArgs e) {
  MessageBox.Show(e.FullPath + e.ChangeType.ToString());
 }
}


I posted it in bugzilla a week ago

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

but havent got any response.


More information about the Mono-list mailing list