Consider the following code which closes an overlapped I/O serial handle during application shutdown.
It works fine under .NET 2.0 but after switching to .NET 4.0 it crashes on the CloseHandle. Removing CancelIO doesnt help.Code:Win32Com.CancelIo(hPort); Win32Com.CloseHandle(hPort);
Does anyone know what the correct way is to close an overlapped I/O handle? And why is there the difference between NET2.0 and 4.0?