Question: I've been developing a windows app in .net C# for GSM Modems and i've come across a strange error:

```
System.ObjectDisposedException was unhandled
  Message="The secure parameter identifier was closed (pt: O parâmetro identificador seguro foi fechado)"
  Source="System"
  ObjectName=""
  StackTrace:
       at Microsoft.Win32.UnsafeNativeMethods.GetOverlappedResult(SafeFileHandle hFile, NativeOverlapped* lpOverlapped, Int32& lpNumberOfBytesTransferred, Boolean bWait)
       at System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

```

This has only happened recently - i have no idea why... could it be i am disposing of a SerialPort and getting an answer of the modem later?? 
- shouldn't this be avoided when i dispose of the SerialPort?

Answer: 
System.ObjectDisposedException always occurs when you are trying to use disposed object, so you've answered on you question by your own =)
Did you register a handler on the port's DataReceived event? If so, you should probably unregister it (and maybe add a Sleep() call to allow any currently running handler to finish) before closing the port.