System.IO.FileNotFoundException

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • darkminos
    New Member
    • Mar 2009
    • 11

    System.IO.FileNotFoundException

    Hi,
    When I try to run my program I get this error message:

    "An exception 'System.IO.File NotFoundExcepti on" has occurred in maintenance.exe "
    "However, no debuggers are registered that can debug this exception. Unable to JIT debug"
    Now, I don't try to read any files on purpose so I cannot insert a catch statement. Is there any other way to find out what file it tries to read?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Do you not have visual studio? How did you build the software?
    Without getting a look at what is really happening, it would be hard to tell.

    The error message shown should have had a little "details" link or "what is contained in this report" type location?

    Comment

    • darkminos
      New Member
      • Mar 2009
      • 11

      #3
      no there is no additional details... and that’s my problem...

      I use VS2008 running on vista, when I try to install the software on a Win XP station It comes up with this error straight away... what I’m really asking is - is there a way to catch a FileNotFoundExc eption before anything else is happening so I could get a rough idea of what file it might be looking for?

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Did you make sure to check for correct versions of .NET installed?
        Are you using any extra DLLs? (Office interop, thirdparty, custom, etc)

        Comment

        • darkminos
          New Member
          • Mar 2009
          • 11

          #5
          .NET is @ 3.5... I actually do use thirdparty controls, but I think I did include all the DLL's into the installer. I will double check that later today and post if I had any luck...

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            You may also need .NET 2 - 3.5 is not an all-inclusive upgrade that includes everything of 2. It is additions to the existing functions of .NET 2

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              Originally posted by darkminos
              no there is no additional details... and that’s my problem...

              I use VS2008 running on vista, when I try to install the software on a Win XP station It comes up with this error straight away... what I’m really asking is - is there a way to catch a FileNotFoundExc eption before anything else is happening so I could get a rough idea of what file it might be looking for?
              Log files. Write a simple text file at the start of each method.

              Attempting to: {blah] with file {FileWidgetPath }
              Success : 10 records found
              Attempting to: {some cool function}



              As far as the file not found exception. You should make a point of writing your software a bit more robustly so it can gracefully handle such problems. You can't assume the files are there... or that the boot drive is C:... or that the monitor is at least 1024x768. Or that the file you want isn't already in use... or that it isn't corrupt.

              You should be wrapping your functions in try/catch blocks...
              You should be checking if a file even exists before you try to access it.
              After you access it, you should validate the data when that method is done before the next method tries to do something with it.
              and so on.

              Comment

              Working...