FileSystemWatcher

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jlea

    #1

    FileSystemWatcher

    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


  • Michael Giagnocavo [MVP]

    #2
    Re: FileSystemWatch er

    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" <jon@leapsoft.c om> wrote in message
    news:OptvZHLqDH A.3180@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I'm trying to watch a file from my XP-Pro workstation to either a Win2000[/color]
    or[color=blue]
    > a NT4 machine and everytime I try to set the path property to something[/color]
    such[color=blue]
    > 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
    >
    >[/color]


    Comment

    • jlea

      #3
      Re: FileSystemWatch er

      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]" <mggUNSPAM@Atre vido.net> wrote in message
      news:%234jR8RNq DHA.2488@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > 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" <jon@leapsoft.c om> wrote in message
      > news:OptvZHLqDH A.3180@TK2MSFTN GP11.phx.gbl...[color=green]
      > > I'm trying to watch a file from my XP-Pro workstation to either a[/color][/color]
      Win2000[color=blue]
      > or[color=green]
      > > a NT4 machine and everytime I try to set the path property to something[/color]
      > such[color=green]
      > > 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
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Michael Giagnocavo [MVP]

        #4
        Re: FileSystemWatch er

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

        "jlea" <jon@leapsoft.c om> wrote in message
        news:%23k4LFZTq DHA.2000@TK2MSF TNGP10.phx.gbl. ..[color=blue]
        > 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[/color]
        found[color=blue]
        > this link:
        >
        >[/color]
        http://msdn.microsoft.com/library/de...t4machines.asp[color=blue]
        >
        > 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]" <mggUNSPAM@Atre vido.net> wrote in message
        > news:%234jR8RNq DHA.2488@TK2MSF TNGP12.phx.gbl. ..[color=green]
        > > First question: Do you have permissions to that share?
        > >
        > > Second: please post the full exception and stack trace along with a[/color][/color]
        small[color=blue][color=green]
        > > bit of code.
        > >
        > > Thanks,
        > > -mike
        > > MVP
        > >
        > > "jlea" <jon@leapsoft.c om> wrote in message
        > > news:OptvZHLqDH A.3180@TK2MSFTN GP11.phx.gbl...[color=darkred]
        > > > I'm trying to watch a file from my XP-Pro workstation to either a[/color][/color]
        > Win2000[color=green]
        > > or[color=darkred]
        > > > a NT4 machine and everytime I try to set the path property to[/color][/color][/color]
        something[color=blue][color=green]
        > > such[color=darkred]
        > > > 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
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • jlea

          #5
          Re: FileSystemWatch er

          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]" <mggUNSPAM@Atre vido.net> wrote in message
          news:OyMOV%23Tq DHA.1324@TK2MSF TNGP09.phx.gbl. ..[color=blue]
          > What's the full stack trace? And to test, don't use NT4.
          > -mike
          > MVP
          >
          > "jlea" <jon@leapsoft.c om> wrote in message
          > news:%23k4LFZTq DHA.2000@TK2MSF TNGP10.phx.gbl. ..[color=green]
          > > Thanks for the reply. I have permission to the share: I'm able to save[/color][/color]
          a[color=blue][color=green]
          > > 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[/color]
          > found[color=green]
          > > this link:
          > >
          > >[/color]
          >[/color]
          http://msdn.microsoft.com/library/de...t4machines.asp[color=blue][color=green]
          > >
          > > 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]" <mggUNSPAM@Atre vido.net> wrote in message
          > > news:%234jR8RNq DHA.2488@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
          > > > First question: Do you have permissions to that share?
          > > >
          > > > Second: please post the full exception and stack trace along with a[/color][/color]
          > small[color=green][color=darkred]
          > > > bit of code.
          > > >
          > > > Thanks,
          > > > -mike
          > > > MVP
          > > >
          > > > "jlea" <jon@leapsoft.c om> wrote in message
          > > > news:OptvZHLqDH A.3180@TK2MSFTN GP11.phx.gbl...
          > > > > I'm trying to watch a file from my XP-Pro workstation to either a[/color]
          > > Win2000[color=darkred]
          > > > or
          > > > > a NT4 machine and everytime I try to set the path property to[/color][/color]
          > something[color=green][color=darkred]
          > > > such
          > > > > as \\PDC1\cdrive\ I get a system.nullExce ption error.
          > > > >
          > > > > Anyone have any ideas? Does this work? It works just fine on my[/color][/color][/color]
          local[color=blue][color=green][color=darkred]
          > > > > machine: "c:\abc\def \"
          > > > >
          > > > > Thanks. Jon Lea
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Michael Giagnocavo [MVP]

            #6
            Re: FileSystemWatch er

            Great find, let me check into this.

            Thanks,
            -mike
            MVP


            "jlea" <jon@leapsoft.c om> wrote in message
            news:%23mfK9QUq DHA.1444@tk2msf tngp13.phx.gbl. ..[color=blue]
            > 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[/color]
            it[color=blue]
            > 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[/color]
            to[color=blue]
            > 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]" <mggUNSPAM@Atre vido.net> wrote in message
            > news:OyMOV%23Tq DHA.1324@TK2MSF TNGP09.phx.gbl. ..[color=green]
            > > What's the full stack trace? And to test, don't use NT4.
            > > -mike
            > > MVP
            > >
            > > "jlea" <jon@leapsoft.c om> wrote in message
            > > news:%23k4LFZTq DHA.2000@TK2MSF TNGP10.phx.gbl. ..[color=darkred]
            > > > Thanks for the reply. I have permission to the share: I'm able to[/color][/color][/color]
            save[color=blue]
            > a[color=green][color=darkred]
            > > > 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[/color]
            > > found[color=darkred]
            > > > this link:
            > > >
            > > >[/color]
            > >[/color]
            >[/color]
            http://msdn.microsoft.com/library/de...t4machines.asp[color=blue][color=green][color=darkred]
            > > >
            > > > 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]" <mggUNSPAM@Atre vido.net> wrote in message
            > > > news:%234jR8RNq DHA.2488@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[/color]
            > > small[color=darkred]
            > > > > bit of code.
            > > > >
            > > > > Thanks,
            > > > > -mike
            > > > > MVP
            > > > >
            > > > > "jlea" <jon@leapsoft.c om> wrote in message
            > > > > news:OptvZHLqDH A.3180@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[/color]
            > > something[color=darkred]
            > > > > such
            > > > > > as \\PDC1\cdrive\ I get a system.nullExce ption error.
            > > > > >
            > > > > > Anyone have any ideas? Does this work? It works just fine on my[/color][/color]
            > local[color=green][color=darkred]
            > > > > > machine: "c:\abc\def \"
            > > > > >
            > > > > > Thanks. Jon Lea
            > > > > >
            > > > > >
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • jlea

              #7
              Re: FileSystemWatch er

              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]" <mggUNSPAM@Atre vido.net> wrote in message
              news:OWCScQgqDH A.1632@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Great find, let me check into this.
              >
              > Thanks,
              > -mike
              > MVP
              >
              >
              > "jlea" <jon@leapsoft.c om> wrote in message
              > news:%23mfK9QUq DHA.1444@tk2msf tngp13.phx.gbl. ..[color=green]
              > > 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[/color][/color]
              has[color=blue]
              > it[color=green]
              > > 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[/color]
              > to[color=green]
              > > 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]" <mggUNSPAM@Atre vido.net> wrote in message
              > > news:OyMOV%23Tq DHA.1324@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
              > > > What's the full stack trace? And to test, don't use NT4.
              > > > -mike
              > > > MVP
              > > >
              > > > "jlea" <jon@leapsoft.c om> wrote in message
              > > > news:%23k4LFZTq DHA.2000@TK2MSF TNGP10.phx.gbl. ..
              > > > > Thanks for the reply. I have permission to the share: I'm able to[/color][/color]
              > save[color=green]
              > > a[color=darkred]
              > > > > 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[/color][/color][/color]
              and[color=blue][color=green][color=darkred]
              > > > found
              > > > > this link:
              > > > >
              > > > >
              > > >[/color]
              > >[/color]
              >[/color]
              http://msdn.microsoft.com/library/de...t4machines.asp[color=blue][color=green][color=darkred]
              > > > >
              > > > > It sounds like FileSystemWatch er has a few problems with network[/color][/color][/color]
              file[color=blue][color=green][color=darkred]
              > > > > watching.
              > > > >
              > > > > Thanks again and let me know what you think. Jon.
              > > > >
              > > > >
              > > > > "Michael Giagnocavo [MVP]" <mggUNSPAM@Atre vido.net> wrote in message
              > > > > news:%234jR8RNq DHA.2488@TK2MSF TNGP12.phx.gbl. ..
              > > > > > First question: Do you have permissions to that share?
              > > > > >
              > > > > > Second: please post the full exception and stack trace along with[/color][/color][/color]
              a[color=blue][color=green][color=darkred]
              > > > small
              > > > > > bit of code.
              > > > > >
              > > > > > Thanks,
              > > > > > -mike
              > > > > > MVP
              > > > > >
              > > > > > "jlea" <jon@leapsoft.c om> wrote in message
              > > > > > news:OptvZHLqDH A.3180@TK2MSFTN GP11.phx.gbl...
              > > > > > > I'm trying to watch a file from my XP-Pro workstation to either[/color][/color][/color]
              a[color=blue][color=green][color=darkred]
              > > > > 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[/color]
              > > local[color=darkred]
              > > > > > > machine: "c:\abc\def \"
              > > > > > >
              > > > > > > Thanks. Jon Lea
              > > > > > >
              > > > > > >
              > > > > >
              > > > > >
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              Working...