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 7 4115
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
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
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."
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."
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."
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."
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." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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.
...
|
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...
|
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...
|
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.
|
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
|
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)...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |