I want to call the below Line of code from BluetoothLE Sample:
static async Task<int> OpenDevice(DeviceInformation DeviceInfo)
{
// some code
await BluetoothLEDevice.FromIdAsync(DeviceInfo.Id).AsTask().TimeoutAfter(_timeout);
// some code
}
'FromIdAsync' function is from 'BluetoothLEDevice' Class:
[RemoteAsync]
public static IAsyncOperation<BluetoothLEDevice> FromIdAsync(string deviceId);
I am getting this Exception:
Method not found: 'System.Threading.Tasks.Task`1<System.__Canon> System.Threading.Tasks.Task.FromCancellation(System.Threading.CancellationToken)'.
I have searched a lot, and there is not enough information about 'FromCancellation' method. It seems this method automatically called when 'await' completes. (its my own supposition)
I am thinking of avoiding 'await' call. Any work around or help would be appreciated. I have 'DeviceInformation' Object which have Device ID. I want to get the 'BluetoothLEDevice' object to move further with 'Services' and 'Characteristics'. I am building a Windows console Application.