tags:

views:

546

answers:

2

Hi,

I am running a .Net 3.5 application on windows XP embadded version. This application is writes and reads some data over the com port. The application works fine on my laptop(windows XP Professional) not on windows XP embedded. I keep getting this error

"System.IO.IOException: The I/O operation has been aborted because of either a thread exit or an application request."

What could be the causing it ???

Some additional info to read I am using ReadExisting and not Readline. Also before reading I am making sure the port is open too.

System.IO.IOException: The I/O operation has been aborted because of either a thread exit or an application request.

at System.IO.Ports.SerialStream.EndRead(IAsyncResult asyncResult) at System.IO.Ports.SerialStream.Read(Byte[] array, Int32 offset, Int32 count, Int32 timeout) at System.IO.Ports.SerialStream.Read(Byte[] array, Int32 offset, Int32 count) at System.IO.Ports.SerialPort.ReadExisting() at ScalesApp.Scales.handleDataReceived(Object sender, SerialDataReceivedEventArgs e) at System.IO.Ports.SerialPort.CatchReceivedEvents(Object src, SerialDataReceivedEventArgs e) at System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents(Object state) at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack) at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

A: 

this severely depends on your windows embedded configuration.

you might know that windows xp embedded is very scalable and you can choose from 1000s of packages which you want to include.

once in the company we've had the problem that beeps aren't forwarded from citrix-session to the local client. after some trial and error we found out that we forgot the "beep-driver". yep, that exists ;o)

have you already tested any other application on the machine using the com-port? you might want to check in the device-manager whether the driver is correctly recognized by the system.

if you havent the option available in your control-panel, you need to copy Sysdm.cpl from another computer's system32-folder to the one on your embedded system.

hope that helps.

regards

Atmocreations
Well my application can communicate for some time then I get the error so I assume that everthing should be in place. However I will double check that.
Prithis
a very nasty trouble and it's nearly impossible to debug this.but if you're able to communicate, the problem could lay elsewhere... have you checked eventlog for messages that have been logged? if yes, please post some of them....
Atmocreations
posted please check above.
Prithis
+1  A: 

The problem is that the fAbortOnError is enabled in SetCommState's DCB, which explains for most of the IOExceptions thrown by the SerialPort object. Some PCs / handhelds have UARTs that enable the abort on error flag by default - so it's imperative that a serial port's init routine clears it (which Microsoft neglected to do). The SerialPort object wasn't designed with fAbortOnError enabled in mind.

I wrote a long article recently to explain this in greater detail (see this if you're interested).

Zach Saw