I have example code and code I am currently writing. Both set have the exact same references. The example code HeartRateLE which I got from GitHub compiles and runs fine. The code I am working on does not compile because of
this code
IAsyncOperation<BluetoothLEDevice> myTask =
BluetoothLEDevice.FromIdAsync(deviceId);
var device = myTask.GetAwaiter().GetResults();
as GetAwaiter does not reference using System; Actually using System; at the top of the class is grayed out showing its not in use.
Both have the Reference of System and both have the same path of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.8\System.dll
Both also have the Reference of Windows.WinMD with the same path of C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.WinMD
Here is the error for GetAwaiter
Error CS4036
'IAsyncOperation<BluetoothLEDevice>'
does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type'IAsyncOperation<BluetoothLEDevice>'
could be found (are you missing a using directive for 'System'?)
I would like to know how to fix it so that GetAwaiter references System.