A set of .NET Framework managed libraries for developing graphical user interfaces.
BLE Disconnect Winforms application
I have a winforms application that I using to connect/communicate to my BLE device. When I am finished with the object, I dispose of the services and then dispose the ble object. However, it won't connect again unless I close the application completely. Need to understand why and what a soulution might be. I even try to force the Garbage Collector. See code below.
public async void Dispose()
{
var services = await bleDevice.GetGattServicesAsync();
foreach (var service in services.Services)
{
service?.Session?.Dispose();
service?.Dispose();
}
bleDevice.Dispose();
bleDevice = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}