
This is a fatal error, there's no way to recover from it, and in release builds, a nasty message box appears. It happens when I call serial_port::cancel and Boost tries to throw some exception. The exact error is:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
I couldn't reproduce this crash (Boost 1.49, MSVC10, Win7), maybe because I don't have any trafic on COM1, but any way -- asio objects are not thread-safe, so it might be unsafe to call cancel() this way. Instead, try using the following: ioService.post([&] {serialPort.cancel();}); - and see if it helps.