How to tackle the error 'The object has been closed'?

0

I'm getting the following error:

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

for the code snippet posted below:

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");
}
uwp
bluetooth-lowenergy
visual-c#-express-2010
asked on Stack Overflow Aug 15, 2019 by user10892633 • edited Aug 15, 2019 by Gonzalo Garcia

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0