I've copied the same piece of code from one project to another and in the first one it compiles fine, but in the second one it doesn't.
The piece is:
using Windows.Devices.Bluetooth;
// a couple of lines of other code
var rfcommProvider = await RfcommServiceProvider.CreateAsync(RfcommServiceId.FromUuid(RfcommChatServiceUuid));
Error:
'await' requires that the type 'Windows.Foundation.IAsyncOperation<Windows.Devices.Bluetooth.Rfcomm.RfcommServiceProvider>' have a suitable GetAwaiter method. Are you missing a using directive for 'System'?
The first project is demo created by Microsoft and it is a Windows 8.1 application.
My application is a normal WPF application and it is targeting .NET 4.5.1 and Windows 8.1 and I added the reference to the Windows.winmd
as described here
I do not know why the same piece of code might compile in one application and not compile in the other one when all common things like references, namespaces, .. are OK. My only idea is that maybe I'm referencing some older version that is not yet awaitable, but I have no idea how to verify this.