title: SerialPort timeouts in standalone mode
body: <p>I have a strange behaviour im my app.</p>
  
  <p>I open a COM port to comunicate witha a device over Bluetooth. I do the following steps:</p>
  
  <ol>
  <li>Open the virtual COM port;</li>
  <li>Switch remote bluetooth to command mode;</li>
  <li>Perform few commands (eg. read remote device's serial number);</li>
  <li>Switch remote bluetooth to data amode;</li>
  <li>Send data to device;</li>
  <li><p>Read a byte of answer (ReadByte() from SerialPort class);</p>
  
  <p>The device works fine and answers immediately and everything is fine while I run my app in debug mode via visual studio.</p></li>
  </ol>
  
  <p>But when I try to run it directly (without visual studio and adebugger attatched - but still compiled with "Debug" option) i get a timeout exception at step 6. </p>
  
  <p>The bug is fully reproducible (no timeouts in Visual Studio, and every time without it).</p>
  
  <p>Does anyone have any idea that could cause such behaviour ?</p>
  
  <p>Here is the code from step 6</p>
  
  <pre><code>    private byte[] ReadResponse() {
  
          try {
              int bytes2Read = 6;
              do {
                  this.buffer.Append((byte)ReadByte()); // &lt;- there the timeout occurs
  
                  if (this.buffer.Length == 6) { // header receiver
                      // bytes 2 and 3 contain message length
                      bytes2Read = this.buffer[2] + (this.buffer[3] &lt;&lt; 8);
                  }
              } while (this.buffer.Length &lt; bytes2Read);
  
              return this.buffer.ToArray();
          } finally {
              this.buffer.Clear();
          }
      }
  </code></pre>
  
  <p>The method is situated in the class that derives from SerialPort class.</p>