• <tfoot id='KLBZ2'></tfoot>

    <small id='KLBZ2'></small><noframes id='KLBZ2'>

    <i id='KLBZ2'><tr id='KLBZ2'><dt id='KLBZ2'><q id='KLBZ2'><span id='KLBZ2'><b id='KLBZ2'><form id='KLBZ2'><ins id='KLBZ2'></ins><ul id='KLBZ2'></ul><sub id='KLBZ2'></sub></form><legend id='KLBZ2'></legend><bdo id='KLBZ2'><pre id='KLBZ2'><center id='KLBZ2'></center></pre></bdo></b><th id='KLBZ2'></th></span></q></dt></tr></i><div id='KLBZ2'><tfoot id='KLBZ2'></tfoot><dl id='KLBZ2'><fieldset id='KLBZ2'></fieldset></dl></div>

    • <bdo id='KLBZ2'></bdo><ul id='KLBZ2'></ul>

      1. <legend id='KLBZ2'><style id='KLBZ2'><dir id='KLBZ2'><q id='KLBZ2'></q></dir></style></legend>
      2. Windows XP 嵌入式版本上 System.IO.IOException 的原因是什么?

        时间:2023-11-10

        <small id='JuZ83'></small><noframes id='JuZ83'>

              <tbody id='JuZ83'></tbody>
              <bdo id='JuZ83'></bdo><ul id='JuZ83'></ul>
            • <tfoot id='JuZ83'></tfoot>

              • <legend id='JuZ83'><style id='JuZ83'><dir id='JuZ83'><q id='JuZ83'></q></dir></style></legend>

                • <i id='JuZ83'><tr id='JuZ83'><dt id='JuZ83'><q id='JuZ83'><span id='JuZ83'><b id='JuZ83'><form id='JuZ83'><ins id='JuZ83'></ins><ul id='JuZ83'></ul><sub id='JuZ83'></sub></form><legend id='JuZ83'></legend><bdo id='JuZ83'><pre id='JuZ83'><center id='JuZ83'></center></pre></bdo></b><th id='JuZ83'></th></span></q></dt></tr></i><div id='JuZ83'><tfoot id='JuZ83'></tfoot><dl id='JuZ83'><fieldset id='JuZ83'></fieldset></dl></div>
                • 本文介绍了Windows XP 嵌入式版本上 System.IO.IOException 的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Windows XP 嵌入式版本上运行 .Net 3.5 应用程序.此应用程序通过串行 (COM) 端口写入和读取一些数据.该应用程序在我的笔记本电脑(Windows XP Professional)上运行良好,但在 Windows XP 嵌入式上运行良好.我不断收到此错误:

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

                  System.IO.IOException:由于线程退出或应用程序请求,I/O 操作已中止.

                  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?

                  一些附加信息:要阅读,我使用的是 ReadExisting 而不是 Readline.另外,在阅读之前,我要确保端口也已打开.

                  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)
                  

                  推荐答案

                  问题是SetCommState的DCB中启用了fAbortOnError,这解释了大部分SerialPort对象抛出的IOExceptions.一些 PC/手持设备具有默认启用错误中止标志的 UART - 因此串行端口的 init 例程必须清除它(微软忽略了这样做).SerialPort 对象在设计时并未考虑启用 fAbortOnError.

                  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).

                  这篇关于Windows XP 嵌入式版本上 System.IO.IOException 的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:同一台 Windows 机器上的串行端口通信不起作用 下一篇:function1 和 function2 是否以线程安全的方式使用我的串口类?

                  相关文章

                  <legend id='VL8pf'><style id='VL8pf'><dir id='VL8pf'><q id='VL8pf'></q></dir></style></legend>
                    <bdo id='VL8pf'></bdo><ul id='VL8pf'></ul>

                  1. <small id='VL8pf'></small><noframes id='VL8pf'>

                  2. <tfoot id='VL8pf'></tfoot>

                      <i id='VL8pf'><tr id='VL8pf'><dt id='VL8pf'><q id='VL8pf'><span id='VL8pf'><b id='VL8pf'><form id='VL8pf'><ins id='VL8pf'></ins><ul id='VL8pf'></ul><sub id='VL8pf'></sub></form><legend id='VL8pf'></legend><bdo id='VL8pf'><pre id='VL8pf'><center id='VL8pf'></center></pre></bdo></b><th id='VL8pf'></th></span></q></dt></tr></i><div id='VL8pf'><tfoot id='VL8pf'></tfoot><dl id='VL8pf'><fieldset id='VL8pf'></fieldset></dl></div>