Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Application.DoEvents(); throwing System.IO.FileNotFoundException ?

Application.DoEvents(); throwing System.IO.FileNotFoundException ?

Scheduled Pinned Locked Moved C#
comdebugginghelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BugMeNotFTW
    wrote on last edited by
    #1

    Ive got the webbrowser control navigating in a foreach loop which doesn't contain any IO yet i get the following exception Exception:Thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'." (System.IO.FileNotFoundException) A System.IO.FileNotFoundException was thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'."

    foreach (string ValueName in Regkey.GetValueNames())
    {
    Browser.Navigate("http://www.google.com");
    System.DateTime ThisMoment = System.DateTime.Now;
    System.TimeSpan duration = new System.TimeSpan(0, 0, 0, 0, 10000);
    System.DateTime AfterWards = ThisMoment.Add(duration);

                    while (Loaded != true || AfterWards >= ThisMoment)
                    {
                        Application.DoEvents();
                        Thread.Sleep(50);
                    }
           }
    

    with Browser.document completed set to the function below

    private void BrowserCallback(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
    Loaded = true;
    }

    No IO is taking place and the path in the exception is correct it even happens whenh im not debuging :confused: Is there any way to fix this or get the foreach loop to wait until Browser.documentcompleted is fired without using a delay ?

    R L 2 Replies Last reply
    0
    • B BugMeNotFTW

      Ive got the webbrowser control navigating in a foreach loop which doesn't contain any IO yet i get the following exception Exception:Thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'." (System.IO.FileNotFoundException) A System.IO.FileNotFoundException was thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'."

      foreach (string ValueName in Regkey.GetValueNames())
      {
      Browser.Navigate("http://www.google.com");
      System.DateTime ThisMoment = System.DateTime.Now;
      System.TimeSpan duration = new System.TimeSpan(0, 0, 0, 0, 10000);
      System.DateTime AfterWards = ThisMoment.Add(duration);

                      while (Loaded != true || AfterWards >= ThisMoment)
                      {
                          Application.DoEvents();
                          Thread.Sleep(50);
                      }
             }
      

      with Browser.document completed set to the function below

      private void BrowserCallback(object sender, WebBrowserDocumentCompletedEventArgs e)
      {
      Loaded = true;
      }

      No IO is taking place and the path in the exception is correct it even happens whenh im not debuging :confused: Is there any way to fix this or get the foreach loop to wait until Browser.documentcompleted is fired without using a delay ?

      R Offline
      R Offline
      Roger Wright
      wrote on last edited by
      #2

      You may not be doing any IO, but the debugging process is. The file that is missing is the config file for the debug process. While you're debugging, the executable that runs is called "myprogram.vshost.exe" and the config file it uses is called "myprogram.vshost.exe.config." Does your project contain a configuration file? I don't know the details, but it appears to be looking for some kind of configuration information for the application, and it's not finding it. If you use Google on the file name, it returns several links that describe the missing file, and ways to suppress its creation. But you may already have a setting in VS that is stopping it from being created, and your app really needs it. From my reading, by the way, it appears that these files are created even when you build a Release version, but there's no need to actually deploy them. Not a complete answer, I know, but at least it narrows the search some. Good luck! :-D

      "A Journey of a Thousand Rest Stops Begins with a Single Movement"

      B 1 Reply Last reply
      0
      • R Roger Wright

        You may not be doing any IO, but the debugging process is. The file that is missing is the config file for the debug process. While you're debugging, the executable that runs is called "myprogram.vshost.exe" and the config file it uses is called "myprogram.vshost.exe.config." Does your project contain a configuration file? I don't know the details, but it appears to be looking for some kind of configuration information for the application, and it's not finding it. If you use Google on the file name, it returns several links that describe the missing file, and ways to suppress its creation. But you may already have a setting in VS that is stopping it from being created, and your app really needs it. From my reading, by the way, it appears that these files are created even when you build a Release version, but there's no need to actually deploy them. Not a complete answer, I know, but at least it narrows the search some. Good luck! :-D

        "A Journey of a Thousand Rest Stops Begins with a Single Movement"

        B Offline
        B Offline
        BugMeNotFTW
        wrote on last edited by
        #3

        Strange but adding a app.config file solved the problem :thumbsup:

        modified on Sunday, June 27, 2010 12:47 PM

        R 1 Reply Last reply
        0
        • B BugMeNotFTW

          Ive got the webbrowser control navigating in a foreach loop which doesn't contain any IO yet i get the following exception Exception:Thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'." (System.IO.FileNotFoundException) A System.IO.FileNotFoundException was thrown: "Could not find file 'C:\Users\Raymond\Desktop\TestProgram\bin\Debug\TestProgram.vshost.exe.config'."

          foreach (string ValueName in Regkey.GetValueNames())
          {
          Browser.Navigate("http://www.google.com");
          System.DateTime ThisMoment = System.DateTime.Now;
          System.TimeSpan duration = new System.TimeSpan(0, 0, 0, 0, 10000);
          System.DateTime AfterWards = ThisMoment.Add(duration);

                          while (Loaded != true || AfterWards >= ThisMoment)
                          {
                              Application.DoEvents();
                              Thread.Sleep(50);
                          }
                 }
          

          with Browser.document completed set to the function below

          private void BrowserCallback(object sender, WebBrowserDocumentCompletedEventArgs e)
          {
          Loaded = true;
          }

          No IO is taking place and the path in the exception is correct it even happens whenh im not debuging :confused: Is there any way to fix this or get the foreach loop to wait until Browser.documentcompleted is fired without using a delay ?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Strange.. might want to check this out: http://www.codinghorror.com/blog/2004/12/is-doevents-evil.html[^]

          1 Reply Last reply
          0
          • B BugMeNotFTW

            Strange but adding a app.config file solved the problem :thumbsup:

            modified on Sunday, June 27, 2010 12:47 PM

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #5

            I thought it might take something like that, but I've had apps with no app.config file that worked fine. Some do, some don't, and I don't yet know why. Glad it solved the problem! :-D

            "A Journey of a Thousand Rest Stops Begins with a Single Movement"

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups