473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

FilesySystemWatcher EnableRaisingEvents Reverts To False

I have a FilesySystemWatcher that is watching a folder on a network share.
After varying periods (sometimes more that a week, sometimes less that a day)
of time the EnableRaisingEvents property becomes False. How can I tell why
this is happening?
--
Jeff
Jul 21 '05 #1
7 4114
Is it possible that the share is becoming unmounted? That may cause the
problem since the FileSystemWatcher can't watch folders that don't exist.

"Jeff Grundy" wrote:
I have a FilesySystemWatcher that is watching a folder on a network share.
After varying periods (sometimes more that a week, sometimes less that a day)
of time the EnableRaisingEvents property becomes False. How can I tell why
this is happening?
--
Jeff

Jul 21 '05 #2
I am thinking it is a transient network problem. I use dbgclr.exe to attach
to the process and flip EnableRaisingEvents back to true. Then the app works
as planned. I have considered using a timer to look at the
EnableRaisingEvents periodicaly and set it to true if it is false but that
won't really tell me WHY this is happening.

"Dathon" wrote:
Is it possible that the share is becoming unmounted? That may cause the
problem since the FileSystemWatcher can't watch folders that don't exist.

"Jeff Grundy" wrote:
I have a FilesySystemWatcher that is watching a folder on a network share.
After varying periods (sometimes more that a week, sometimes less that a day)
of time the EnableRaisingEvents property becomes False. How can I tell why
this is happening?
--
Jeff

Jul 21 '05 #3
Hi Jeff,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that your
FileSystemWatcher.EnableRaisingEvents property becomes false after the app
runs for some time. If there is any misunderstanding, please feel free to
let me know.

I have tried many methods on my machine to reproduce this. The
FileSystemWatcher.EnableRaisingEvents remains to be true however the folder
is changed.

When I disable sharing of the folder and share it again, the
FileSystemWatcher stops responding. However, when I took a look at the
FileSystemWatcher.EnableRaisingEvents property, it remains to be true.

Could you try to check in the code to see if the FileSystemWatcher object
would be re-constructed somewhere?

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4
There is a timer that checks for changes in a database. If there is a change
to the database then the FileSystemWatcher would be recreated without being
first dropped. This is the same method (LoadWatcher) that initally
instanciates the watcher.

If myWatcher has previously been instanciated, should I set myWatcher to
nothing before I call LoadWatcher ?

Private Sub LoadWatcher()
myWatcher = New FileSystemWatcher
myWatcher.Path = mstrCurrentPath
myWatcher.EnableRaisingEvents = True
End Sub

"Kevin Yu [MSFT]" wrote:
Hi Jeff,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that your
FileSystemWatcher.EnableRaisingEvents property becomes false after the app
runs for some time. If there is any misunderstanding, please feel free to
let me know.

I have tried many methods on my machine to reproduce this. The
FileSystemWatcher.EnableRaisingEvents remains to be true however the folder
is changed.

When I disable sharing of the folder and share it again, the
FileSystemWatcher stops responding. However, when I took a look at the
FileSystemWatcher.EnableRaisingEvents property, it remains to be true.

Could you try to check in the code to see if the FileSystemWatcher object
would be re-constructed somewhere?

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #5
Hi Jeff,

I don't think this matters. When instanciating another watcher, the
reference is pointed to another watcher object. The original one will be
disposed next time GC collects garbage. Could you find out under what
circumstances will this occur definitely?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #6
The was my original question: "How can I tell why this is happening?" and I
still don't know!

One way to recreate the problem is to set the FileSystemWatcher to watch a
remote share then reboot the machine that is hosting the share.

I implimented a timer that looks to see if the FSW.EnableRaisingEvents is
set to false , and if FSW.EnableRaisingEvents is false, the timer sets
FSW.EnableRaisingEvents to true. That's my workaround. I will probably create
a class that inherits the FileSystemWatcher and also has the timer logic
built in because I am having this problem with all my FileSystemWatchers.

"Kevin Yu [MSFT]" wrote:
Hi Jeff,

I don't think this matters. When instanciating another watcher, the
reference is pointed to another watcher object. The original one will be
disposed next time GC collects garbage. Could you find out under what
circumstances will this occur definitely?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #7
Hi Jeff,

Thanks for your repro steps. Actually, this behavior of FileSystemWatcher
is by design.

Just as tanagra mentioned, when the server is shutting down, the share is
becoming unmounted. This causes the
problem since the FileSystemWatcher can't watch folders that don't exist.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. ...
10
by: Sylvain Thenault | last post by:
Hi there ! Can someone explain me the following behaviour ? >>> l = >>> 0 in (l is False) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: iterable argument...
3
by: drs | last post by:
I just upgraded my Python install, and for the first time have True and False rather than 1 and 0. I was playing around at the command line to test how they work (for instance, "if 9:" and "if...
35
by: Steven Bethard | last post by:
I have lists containing values that are all either True, False or None, e.g.: etc. For a given list: * If all values are None, the function should return None.
15
by: F. Da Costa | last post by:
Hi all, Following two sniperts of code I'm using and getting very interesting results from. ..html <tr id="1" class="segment" open="false"> This is the segment under 'investigation' ..js
1
by: philjhanna | last post by:
Hi I'm having a problem applying return false to a div via addEventListener. I'm adding this so that I can drag (click-hold-move) over an image. (Its so that I can add zooming to the image)...
14
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I took a C course some time ago, but I'm only now beginning to use it, for a personal pet project. My current stumbling-block is finding an efficient way to find a match between the beginning of a...
7
by: Jeff Grundy | last post by:
I have a FilesySystemWatcher that is watching a folder on a network share. After varying periods (sometimes more that a week, sometimes less that a day) of time the EnableRaisingEvents property...
2
by: Warren Sarle | last post by:
The page http://warrensarle.com/temp.html has three lines of text. The top one is a p element saying "Not in a form", which is not in a form. The middle one is a button element saying "Button...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.