如何解决“对象已关闭”错误?

时间:2019-08-15 17:48:37

标签: uwp bluetooth-lowenergy visual-c#-express-2010

我遇到以下错误:

 Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.ni.dll ErrorThe object has been closed. (Exception from HRESULT: 0x80000013)

对于下面发布的代码段:

var writer = new DataWriter();
writer.WriteBytes(packet_command);
GattWriteResult write_result = await       PacketCharacteristic.WriteValueWithResultAsync(writer.DetachBuffer());
if (write_result.Status == GattCommunicationStatus.Success)
{
    Debug.WriteLine("PACKETS SENT TO DEVICE = " + BitConverter.ToString(packet_command));
}
else
{
    Debug.WriteLine("NOT WRITING TO DEVICE");
}

0 个答案:

没有答案