I'm attempting to segregate functionality from the UWP example for BLE into a separate library for testing.
I was successful in setting it up as a standalone test library (using netcore 3.0)
However, in migrating to my GUI app (Now using netcore 5.0) WinRT can no longer be referenced so I had to remove a reference to Windows contracts.
Now I'm running and able to find my BLE device fine (even the correct read/write characteristics) but now when I write to write to the device characteristic I get a breaking crash with the the NullReferenceException.
All of the variables inside the involved object seem not null except for Device ID in the Gatt Characteristic which hides an Interop COM exception, however, this is also true of my "console app" in 3.0 and it does not have this issue and works fine (even with the same conditions present)
How can I debug this deeper? Is this a security issue?
I am targetting net5.0-windows10.0.19041
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Library.BleLib.BleComms.<WriteBufferToSelectedCharacteristicAsync>d__21.MoveNext() in C:\Testing\Net\trunk\Externals\BleLib\BleComms.cs:line 200