UnauthorizedAccessException in serialPort
<p>i am doing C# coding on COM port, i was unable to understand the meaning of this exception, i try to find the answer in my book and web, but no good news.</p>

<p>So my question is how to find the definition of the right exception name(I copy this code from web).
2. what's this ex? an object of the exception?
3. Do I need to add anything to Message?</p>

<p>Thanks for your replies.</p>

<p>code is very simple:</p>

<pre><code>internal void OpenPort(string portName)
{
    try
    {
        myComPort.PortName = portName;
        myComPort.Open();
    }
    catch (UnauthorizedAccessException ex)
    {
        MessageBox.Show(ex.Message);
    }
    finally { }
}
</code></pre>
