473,549 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er

I'm trying to watch a file from my XP-Pro workstation to either a Win2000 or
a NT4 machine and everytime I try to set the path property to something such
as \\PDC1\cdrive\ I get a system.nullExce ption error.

Anyone have any ideas? Does this work? It works just fine on my local
machine: "c:\abc\def \"

Thanks. Jon Lea
Jul 21 '05 #1
6 2988
First question: Do you have permissions to that share?

Second: please post the full exception and stack trace along with a small
bit of code.

Thanks,
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
I'm trying to watch a file from my XP-Pro workstation to either a Win2000 or a NT4 machine and everytime I try to set the path property to something such as \\PDC1\cdrive\ I get a system.nullExce ption error.

Anyone have any ideas? Does this work? It works just fine on my local
machine: "c:\abc\def \"

Thanks. Jon Lea

Jul 21 '05 #2
Thanks for the reply. I have permission to the share: I'm able to save a
file to that share from within Word. I'm using the following code:

void FileWatcher::Se tFile(String* fullPathName)

{

FileInfo* fi = new FileInfo(fullPa thName);

m_watcher->Path = fi->DirectoryNam e;

m_watcher->EnableRaisingE vents = true;

m_watcher->Filter = fi->Name;

}
and the exact exception is:

A "System.NullRef erenceException " occured.
Object reference not set to an instance of an object.

and it occurs on this line:

m_watcher->Path = fi->DirectoryNam e;

and fi->DirectoryNam e returns \\Pdc1\cdrive\.

I was doing some searching on the net about the FileSystemWatch er and found
this link:

http://msdn.microsoft.com/library/de...t4machines.asp

It sounds like FileSystemWatch er has a few problems with network file
watching.

Thanks again and let me know what you think. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
First question: Do you have permissions to that share?

Second: please post the full exception and stack trace along with a small
bit of code.

Thanks,
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
I'm trying to watch a file from my XP-Pro workstation to either a
Win2000 or
a NT4 machine and everytime I try to set the path property to something

such
as \\PDC1\cdrive\ I get a system.nullExce ption error.

Anyone have any ideas? Does this work? It works just fine on my local
machine: "c:\abc\def \"

Thanks. Jon Lea


Jul 21 '05 #3
What's the full stack trace? And to test, don't use NT4.
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Thanks for the reply. I have permission to the share: I'm able to save a
file to that share from within Word. I'm using the following code:

void FileWatcher::Se tFile(String* fullPathName)

{

FileInfo* fi = new FileInfo(fullPa thName);

m_watcher->Path = fi->DirectoryNam e;

m_watcher->EnableRaisingE vents = true;

m_watcher->Filter = fi->Name;

}
and the exact exception is:

A "System.NullRef erenceException " occured.
Object reference not set to an instance of an object.

and it occurs on this line:

m_watcher->Path = fi->DirectoryNam e;

and fi->DirectoryNam e returns \\Pdc1\cdrive\.

I was doing some searching on the net about the FileSystemWatch er and found this link:

http://msdn.microsoft.com/library/de...t4machines.asp
It sounds like FileSystemWatch er has a few problems with network file
watching.

Thanks again and let me know what you think. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
First question: Do you have permissions to that share?

Second: please post the full exception and stack trace along with a small bit of code.

Thanks,
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
I'm trying to watch a file from my XP-Pro workstation to either a Win2000
or
a NT4 machine and everytime I try to set the path property to

something such
as \\PDC1\cdrive\ I get a system.nullExce ption error.

Anyone have any ideas? Does this work? It works just fine on my local
machine: "c:\abc\def \"

Thanks. Jon Lea



Jul 21 '05 #4
Michael - I think I've solved my problem - its amazing what a day makes.
Apparently the FileInfo class drops the last "\" on network files and has it
for local drives. I added some code to make sure the last "\" is on the
directory name before asssigning it to the path property and things seem to
work now. So I can use my XP-Pro workstation to watch files on the NT4
server and also on another Win2000 workstation. I'm in the process of
testing it with a Win2000 workstation going to the NT4 server.

Thanks for the help. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:Oy******** ********@TK2MSF TNGP09.phx.gbl. ..
What's the full stack trace? And to test, don't use NT4.
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Thanks for the reply. I have permission to the share: I'm able to save a
file to that share from within Word. I'm using the following code:

void FileWatcher::Se tFile(String* fullPathName)

{

FileInfo* fi = new FileInfo(fullPa thName);

m_watcher->Path = fi->DirectoryNam e;

m_watcher->EnableRaisingE vents = true;

m_watcher->Filter = fi->Name;

}
and the exact exception is:

A "System.NullRef erenceException " occured.
Object reference not set to an instance of an object.

and it occurs on this line:

m_watcher->Path = fi->DirectoryNam e;

and fi->DirectoryNam e returns \\Pdc1\cdrive\.

I was doing some searching on the net about the FileSystemWatch er and

found
this link:

http://msdn.microsoft.com/library/de...t4machines.asp

It sounds like FileSystemWatch er has a few problems with network file
watching.

Thanks again and let me know what you think. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
First question: Do you have permissions to that share?

Second: please post the full exception and stack trace along with a

small bit of code.

Thanks,
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
> I'm trying to watch a file from my XP-Pro workstation to either a

Win2000
or
> a NT4 machine and everytime I try to set the path property to something such
> as \\PDC1\cdrive\ I get a system.nullExce ption error.
>
> Anyone have any ideas? Does this work? It works just fine on my local > machine: "c:\abc\def \"
>
> Thanks. Jon Lea
>
>



Jul 21 '05 #5
Great find, let me check into this.

Thanks,
-mike
MVP
"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Michael - I think I've solved my problem - its amazing what a day makes.
Apparently the FileInfo class drops the last "\" on network files and has it for local drives. I added some code to make sure the last "\" is on the
directory name before asssigning it to the path property and things seem to work now. So I can use my XP-Pro workstation to watch files on the NT4
server and also on another Win2000 workstation. I'm in the process of
testing it with a Win2000 workstation going to the NT4 server.

Thanks for the help. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:Oy******** ********@TK2MSF TNGP09.phx.gbl. ..
What's the full stack trace? And to test, don't use NT4.
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Thanks for the reply. I have permission to the share: I'm able to save
a
file to that share from within Word. I'm using the following code:

void FileWatcher::Se tFile(String* fullPathName)

{

FileInfo* fi = new FileInfo(fullPa thName);

m_watcher->Path = fi->DirectoryNam e;

m_watcher->EnableRaisingE vents = true;

m_watcher->Filter = fi->Name;

}
and the exact exception is:

A "System.NullRef erenceException " occured.
Object reference not set to an instance of an object.

and it occurs on this line:

m_watcher->Path = fi->DirectoryNam e;

and fi->DirectoryNam e returns \\Pdc1\cdrive\.

I was doing some searching on the net about the FileSystemWatch er and

found
this link:

http://msdn.microsoft.com/library/de...t4machines.asp
It sounds like FileSystemWatch er has a few problems with network file
watching.

Thanks again and let me know what you think. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> First question: Do you have permissions to that share?
>
> Second: please post the full exception and stack trace along with a

small
> bit of code.
>
> Thanks,
> -mike
> MVP
>
> "jlea" <jo*@leapsoft.c om> wrote in message
> news:Op******** ******@TK2MSFTN GP11.phx.gbl...
> > I'm trying to watch a file from my XP-Pro workstation to either a
Win2000
> or
> > a NT4 machine and everytime I try to set the path property to

something
> such
> > as \\PDC1\cdrive\ I get a system.nullExce ption error.
> >
> > Anyone have any ideas? Does this work? It works just fine on my local > > machine: "c:\abc\def \"
> >
> > Thanks. Jon Lea
> >
> >
>
>



Jul 21 '05 #6
I had also made some other changes in my attempt to fix things up when I
stumbled upon this so I don't know if this was the only/real culprit. A
colleague of mine here said he had seen the same behavior with FileInfo so
he wasn't surprised to hear it. Let me know what you find. Jon.

"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:OW******** ******@TK2MSFTN GP10.phx.gbl...
Great find, let me check into this.

Thanks,
-mike
MVP
"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Michael - I think I've solved my problem - its amazing what a day makes.
Apparently the FileInfo class drops the last "\" on network files and has
it
for local drives. I added some code to make sure the last "\" is on the
directory name before asssigning it to the path property and things seem

to
work now. So I can use my XP-Pro workstation to watch files on the NT4
server and also on another Win2000 workstation. I'm in the process of
testing it with a Win2000 workstation going to the NT4 server.

Thanks for the help. Jon.
"Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
news:Oy******** ********@TK2MSF TNGP09.phx.gbl. ..
What's the full stack trace? And to test, don't use NT4.
-mike
MVP

"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> Thanks for the reply. I have permission to the share: I'm able to

save
a
> file to that share from within Word. I'm using the following code:
>
> void FileWatcher::Se tFile(String* fullPathName)
>
> {
>
> FileInfo* fi = new FileInfo(fullPa thName);
>
> m_watcher->Path = fi->DirectoryNam e;
>
> m_watcher->EnableRaisingE vents = true;
>
> m_watcher->Filter = fi->Name;
>
> }
>
>
> and the exact exception is:
>
> A "System.NullRef erenceException " occured.
> Object reference not set to an instance of an object.
>
> and it occurs on this line:
>
> m_watcher->Path = fi->DirectoryNam e;
>
> and fi->DirectoryNam e returns \\Pdc1\cdrive\.
>
> I was doing some searching on the net about the FileSystemWatch er and found
> this link:
>
>

http://msdn.microsoft.com/library/de...t4machines.asp
>
> It sounds like FileSystemWatch er has a few problems with network file > watching.
>
> Thanks again and let me know what you think. Jon.
>
>
> "Michael Giagnocavo [MVP]" <mg*******@Atre vido.net> wrote in message
> news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> > First question: Do you have permissions to that share?
> >
> > Second: please post the full exception and stack trace along with a small
> > bit of code.
> >
> > Thanks,
> > -mike
> > MVP
> >
> > "jlea" <jo*@leapsoft.c om> wrote in message
> > news:Op******** ******@TK2MSFTN GP11.phx.gbl...
> > > I'm trying to watch a file from my XP-Pro workstation to either a > Win2000
> > or
> > > a NT4 machine and everytime I try to set the path property to
something
> > such
> > > as \\PDC1\cdrive\ I get a system.nullExce ption error.
> > >
> > > Anyone have any ideas? Does this work? It works just fine on my

local
> > > machine: "c:\abc\def \"
> > >
> > > Thanks. Jon Lea
> > >
> > >
> >
> >
>
>



Jul 21 '05 #7

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

Similar topics

4
9081
by: Josh Usovsky | last post by:
I'm setting up a watched folder using FileSystemWatcher. When I drop a small file into the watched folder, I can respond to a .Created event and process the file with other code. However, if I try copying a large file into the watched folder, the .Created event is fired off immediately and not when the file is finished copying. I have tried...
1
3317
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the documentation states that if more than one file is copied to the folder at the same time, a cache will queue them up for processing, but when I drop 3 files...
7
4098
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know when its done. Does anyone know the right combination of flags to use to catch when the file has been written and closed? (here is my current code)....
2
2204
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange, onRename and so on. And I had made this program as a windows service.As I know, if I delete a file from my directory, this behavior will active this...
13
9124
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just multiple directories. I have hit a snag and don't know how to get around it. Basically I read in a list of directories from the app.config and...
3
14236
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started a working thread for processing the file, created a new FileSystemWatcher (as he said for real time processing), and then called the join method for...
20
4430
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have...
12
7424
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
5
24104
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong? Thanks Goran
5
5561
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher, monitors a folder and then returns the contents of the new/changed files. However, if the client app loses connection to the webservice without...
0
7520
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.