title: Visual C# very poor performance in while loop
body: <p>I am having some trouble with <code>while</code> loops in C#. This happens let's say once per week.
  I am looping through a SQL Server data reader and I read simple strings, doubles etc ... I don't understand why this happens once in a while. If there were a problem in my code then its performance should be ALWAYS poor.</p>
  
  <p>To be more specific, when this happens, when I set a breakpoint, the thread breaks after 3 or 4 seconds. And the weirdest thing is that if I press F5 or if I "step-by-step" the loop, it takes less time !</p>
  
  <p>That's really weird and it makes me crazy.</p>
  
  <p>I am wondering if someone ever encountered this type of weird deal.</p>
  
  <p>Thanks in advance for your replies !</p>
  
  <p>PS : The <code>while</code> loop is executed by a particular thread (not the main one). </p>
  
  <p>PS 2 : here is my code</p>
  
  <pre><code>reader = DBConnect.GetInstance.ExecuteReader(request.ToString(), out connection, timeOut);
  
  while (reader.Read())
  {
      SourceInst sourceInst = new SourceInst();
      sourceInst.Load(reader);
      sourceInstList.Add(sourceInst);
  }
  </code></pre>