[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

FileSystemWatcher Changed Event fired TWICE

(Eric Marc Loebenberg)

12/28/2002 2:36:00 AM

I am using the FileSystemWatcher Changed Event on a local system with
no anti-viral software. I only catch the 'LastWrite' change. When I
save a file in NotePad, the changed event is called TWICE with
identical object parameters.

I have read a few similar problems in .NET newsgroups but never a
clear explanation as to why this happens and how to work around this.
I created this problem with VB and C# and the problem even occurs if I
use the GotDotNet sample called FileWatcher downloadable in a zip at :

http://www.gotdotnet.com/Community/User/Samples/download.aspx?FileGuid=9d839976-7f83-4139-a93e-03...

Can anyone help? Thanks.

Eric Marc Loebenberg
eric_marc.loebenbergNOSPAM@cgi.com
1 Answer

(Eric Marc Loebenberg)

1/9/2003 1:22:00 AM

0

I hear from someone at Microsoft that it is normal under NTFS to
receive 2 or more identical events when a file is changed. One event
to update the file meta-information and one event for each block-write
to disk.

Too bad that the .NET documentation did not point out this normality.

Also, there should be a single event available AFTER the file writing
operation is complete!