title: Break in dubugger not "working".. code execution continues
body: <p>I have a winforms project which depends on a custom library.  Everything with the app is working fine except a problem I can not pin down.  Basically I have a form which is created from another form which displays it as a dialog:</p>
  
  <pre><code>DataItems.ImportForm frmImportTextDelimited = new DataItems.ImportForm();
  frmImportTextDelimited.ShowDialog();
  </code></pre>
  
  <p>This dialog form populates a dropdown list from the SqlServer using the below function which is from a class library in the solution:</p>
  
  <pre><code>public class AuthorityTypeSearcher
  {
      public List&lt;IntValuePair&gt; GetAllAuthorityTypes()
      {
          List&lt;IntValuePair&gt; returnList = new List&lt;IntValuePair&gt;();
          using (var conn = new SqlConnection(Globals.ConnString))
          {
              var cmd = new SqlCommand();
              cmd.Connection = conn;
              cmd.CommandText = "SELECT FROM tblAuthorityTypes";
              conn.Open();
              IntValuePair ivp;
              SqlDataReader rdr = cmd.ExecuteReader();
              while (rdr.Read())
              {
                  ivp = new IntValuePair();
                  ivp.TheInt = Convert.ToInt32(rdr["ID"]);
                  ivp.TheValue = rdr["AuthorityType"].ToString() ;
              }
          }
          return returnList;
      }
  </code></pre>
  
  <p>This function never returns a value, so I set a breakpoint on the line:</p>
  
  <pre><code>            conn.Open();
  </code></pre>
  
  <p>When the code executes, the Visual studio correctly breaks to this line.  What is making me crazy is that when I step forward to the line:</p>
  
  <pre><code>            SqlDataReader rdr = cmd.ExecuteReader();
  </code></pre>
  
  <p>The debugger will not move forward to the next line, and code execution appears to return to the UI (the form is displayed).  What is also strange is that if I interact with the form (i.e. click a button on the form which populates another field), the debugger breaks again, I return to visual studio, which correctly "breaks" to the line related to that operation. It seems like, for whatever reason, when I get to the line that creates the data reader, code execution simply "leaves" the library and returns to the winforms app.</p>
  
  <p>When code execution appears to have returned to the UI, if I return to visual studio it appears that code execution is continuing, at least I can not click "continue" (play).  The code execution is not "paused".</p>
  
  <p>What is also strange is that if I close the form (dialog), it breaks back into the debugger on the line from the main form on the line:</p>
  
  <pre><code>frmImportTextDelimited.ShowDialog();
  </code></pre>
  
  <p>as though I were still debugging.</p>
  
  <p>Hopefully this makes sense?  I can't figure out why, when debugging, I cant step past the line where I create the data reader, and why code execution goes back to the UI, but returns to the debugger with the dialog is closed.  No error is ever thrown.</p>
  
  <p>Thanks for any advice!</p>