title: FileNotFoundException occurs only when running outside the debugger
body: <p>I have this simple code that opens a txt file:</p>
  
  <blockquote>
    <p>StreamReader sourceFile = File.OpenText(fileName)</p>
  </blockquote>
  
  <p>the thing is, when I press ctrl-f5 to start the program, I get a file doesn't exist error.
  but when I press f11 to go step by step, everything runs smooth and no errors or what so ever happens and i get the desired results.
  any idea what could be the cause of this?</p>
  
  <p>I'm using visual studio C# express 2010.</p>
  
  <p>The code in Program.cs:</p>
  
  <blockquote>
    <p>Class1.ReadPointsFile(@"Points.txt");</p>
  </blockquote>
  
  <p>The function:</p>
  
  <pre><code>public void ReadPointsFile(string fileName)
          {
              if (!File.Exists(fileName))
              {
                  Console.WriteLine("File doesn't exist.");
                  return;
              }
              using (StreamReader sourceFile = File.OpenText(fileName))
              {
                  string inputLine;
                  int arraySize;
                  arraySize = Convert.ToInt32(sourceFile.ReadLine());
                  pointsArray = new Point2D[arraySize];
                  int i_keepTrack = 0;
                  inputLine = sourceFile.ReadLine();
                  do
                  {
                      string[] Coordinations = inputLine.Split(' ');
                      pointsArray[i_keepTrack] = new Point2D(double.Parse(Coordinations[0]), double.Parse(Coordinations[1]));
                      i_keepTrack++;
                      inputLine = sourceFile.ReadLine();
                  } while (inputLine != null);
              }
          }
  </code></pre>