FromBluetoothAddressAsync IAsyncOperation does not contain a definition for 'GetAwaiter' error
To await an IAsyncOperation
, you need two things:
- A reference to
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
- A reference to
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.WinMD
If either reference is missing then it won't work. You can also use the UwpDesktop nuget package, that will do the work for you.
Note: specifically GetAwaiter
is extension in System
namespace that is available from those references (you still need using System;
- make sure you have not removed it from the file). The extension info is on MSDN - WindowsRuntimeSystemExtensions.GetAwaiter.
For some of the other UWP operations just add using System
:
using System;
//...
// example - getting file reference:
var file = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("myFile.txt);