Henk Holterman's answer is correct: SerialPort is a managed resource that itself owns an unmanaged resource and, therefore, implements IDisposable .
Since your shell owns SerialPort, it indirectly owns the unmanaged SerialPort resource and, therefore, must implement IDisposable. Your implementation is incorrect, your own instance of SerialPort should only be removed if disposing is true, since it is a managed resource.
It should be implemented as follows:
private void Dispose(bool disposing) { if (!_disposed) { if (disposing) {
In addition, as Henk Holterman points out, you only need a destructor if you directly own unmanaged resources, which is not the case here, and you can simplify the implementation of IDisposable by getting rid of the destructor.
Joe
source share