c# - System.IO.IOException:向信号量发送了太多帖子
问题描述
我正在.net (Xamarin) 中开发一个应用程序,我正在尝试建立与串行端口的连接。每当我尝试打开与端口的连接时,都会收到此错误消息:
System.IO.IOException: '发送到信号量的帖子太多'
通过谷歌搜索找不到任何具体的内容。任何帮助表示赞赏!
示例代码:
private void Open()
{
IsOpen = true;
_serialPort.PortName = "COM3";
_serialPort.BaudRate = 19200;
_serialPort.Parity = Parity.None;
_serialPort.DataBits = 8;
_serialPort.StopBits = StopBits.One;
_serialPort.Handshake = Handshake.None;
_serialPort?.Open();
}
解决方案
这是因为您需要添加
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
到您的 Package.appxmanifest。
我花了一段时间才自己弄清楚这一点。
推荐阅读
- node.js - expressjs - 未设置响应正文
- python-3.x - Python Pandas Pivot - 将 Aggc 列值更改为行
- kubernetes - kuberentes 通信无法跨节点工作
- xamarin - 在 Xamarin Forms 进度条的两端添加标签
- python - Python:将绑定方法更改为另一种方法
- javascript - Javascript VS Objective-C VS Swift 中的经典继承与原型继承
- npm - npm 错误!在“...”附近解析时 JSON 输入意外结束:{“shasum”:“ae6c2edf”
- android - 如何解决工作管理器的多实例问题?
- laravel - React-Native TypeError: Undefined is not an object (评估 this.state.signatures.length)
- reactjs - 使用 ReactJS -> Express 还是使用 Express -> ReactJS 更好?