P
Padu
Hi,
I know that the System.IO.Ports.Serial port event for receiving data
(DataReceived) happens on a secondary thread, and that if there will be any
interaction of that data with the UI, it should be done through invoke.
Right now my application receives serial data and a class hierarchy is
responsible for handling it.
If I run the application, everything seems to work fine, but if I put a
breakpoint on it and try to follow, the weirdest things happen. For example,
sometimes it gives error messages, sometimes the application just stops
(vanishes is the correct word) and some other times VS IDE halts and
completely goes away. That usually happens if I put the mouse over any
variable and try to inspect its value.
For me it smells like threading problems (and if it smell like a duck and
walk like a duck...).
What is the best practice on handling the received data once it arrives (and
triggers the event) on the serial port? Do I have to synchronize it with the
main app thread?
Cheers
Padu
I know that the System.IO.Ports.Serial port event for receiving data
(DataReceived) happens on a secondary thread, and that if there will be any
interaction of that data with the UI, it should be done through invoke.
Right now my application receives serial data and a class hierarchy is
responsible for handling it.
If I run the application, everything seems to work fine, but if I put a
breakpoint on it and try to follow, the weirdest things happen. For example,
sometimes it gives error messages, sometimes the application just stops
(vanishes is the correct word) and some other times VS IDE halts and
completely goes away. That usually happens if I put the mouse over any
variable and try to inspect its value.
For me it smells like threading problems (and if it smell like a duck and
walk like a duck...).
What is the best practice on handling the received data once it arrives (and
triggers the event) on the serial port? Do I have to synchronize it with the
main app thread?
Cheers
Padu