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.
IAsyncOperationIReadOnlyListUserNotification' does not contain a definition for 'GetAwaiter'
You should add
using System.WindowsRuntimeSystemExtensions;
this is from the System.Runtime.WindowsRuntime assembly and holds a class with the GetAwaiter extensions.
GetAwaiter not using system
Add below using, this is from the System.Runtime.WindowsRuntime assembly and holds a class with the GetAwaiter extensions.
using System.WindowsRuntimeSystemExtensions;
Create file in StorageFolder
You should write using System;
at the the top of the file.
Connecting to bluetooth device using BluetoothLEDevice.FromIdAsync results in errors
My answer is late, but I was struggling with the same problem, and the solution is to include this .dll
"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll"
How do I get an app licence from Microsoft Store?
Looks like the comment from ps2goat was right. I somehow missed the bit where of adding the references.
From the other post, this is the answer..
https://stackoverflow.com/a/44102996/3051507
Related Topics
Equivalent Code of Createobject in C#
Convert String to Decimal, Keeping Fractions
What's the Max Items in a List<T>
How to Display the String HTML Contents into Webbrowser Control
Wpf Combobox: Different Template in Textbox and Drop-Downlist
Check If an Executable Exists in the Windows Path
Thread Safety of a Dictionary<Tkey, Tvalue>
Htmlagilitypack - Remove Script and Style
Get the Name of a Method Using an Expression
How Is the Boxing/Unboxing Behavior of Nullable<T> Possible
Select Either a File or Folder from the Same Dialog in .Net
Create Object Instance of a Class Having Its Name in String Variable
How to Add Moving Effects to My Controls in C#
Variable Declarations Following If Statements
Merge 2 Datatables and Store in a New One
How to Detect the Original MAC Address After It Has Been Spoofed