title: C#: Proper way to close SerialPort with Winforms
body: <p>I have an app where I read from the serialport, everything goes fine, until I close the app. When I click on the [X] the app simply hangs, the UI: unresponsive.</p>
  
  <p>I read from the port in the DataReceived event handler, and I close the port when FormClosed happens:</p>
  
  <pre><code>    private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
      {
          mySerialPort.Close();
      }
  </code></pre>