[Mono-dev] Problem with FileSystemWatcher

Chakotey STME chakoteystme at gmail.com
Wed Nov 17 08:45:58 EST 2010


Hi Community,

I have a big problem with the FileSystemWatcher.
This is my source-Code:

Private i As Integer = 0
    Sub Main()
        Dim m_PerfdataFileWatcher As IO.FileSystemWatcher = New
IO.FileSystemWatcher

        m_PerfdataFileWatcher.Filter = "service-perfdata"
        m_PerfdataFileWatcher.Path = "S:\testfiles"

        AddHandler m_PerfdataFileWatcher.Changed, AddressOf OnChanged
        AddHandler m_PerfdataFileWatcher.Deleted, AddressOf OnChanged

        m_PerfdataFileWatcher.EnableRaisingEvents = True

        Console.ReadLine()

        Console.WriteLine(i)
    End Sub

    Private Sub OnChanged(ByVal source As Object, ByVal e As
FileSystemEventArgs)
        i = i + 1
    End Sub

If I execute this programm under windows and .net and make a change in
the file, FileSystemWatcher get me 2 events.
It works perfect.

If I run this programm under linux and Mono 2.6 (with changed
Filepath) I get around 1885 events!
The file size is around 13MB.

If I use a smaller file (40KB) I get 2 events.

So is there a bug in the implementation of FileSystemWatcher in Mono?
Or is the problem on my side? Do I have to do further settings?

I hope you can help me, because I really need the FileSystemWatcher
for large Files (maybe 4GB).

thanks.


More information about the Mono-devel-list mailing list