Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TaskAwaiter cannot be inferred from the usage

Tags:

c#

async-await

I get a red line under my await in my code saying: The type arguments for method 'TaskAwaiter<TResult> System.WindowsRuntimeSystemExtensions.GetAwaiter<TResult>(this Windows.Foundation.IAsyncOperation 1)' cannot be inferred from the usage. Try specifying the type arguments explicitly

Though the code compiles and seems to work fine, I just wonder what this means? (English is not my first language, so I might just not understand the message)

private async void Init()
{
    var settings = new I2cConnectionSettings(I2CAddress);
    settings.BusSpeed = I2cBusSpeed.StandardMode;

    var aqs = I2cDevice.GetDeviceSelector(I2CControllerName);
    var dis = await DeviceInformation.FindAllAsync(aqs);
    _device = await I2cDevice.FromIdAsync(dis[0].Id, settings);
    _isInited = true;
}
like image 944
Christian Bekker Avatar asked Jun 25 '15 20:06

Christian Bekker


1 Answers

Updated resharper to latest version, solved issue

like image 67
Christian Bekker Avatar answered Sep 19 '22 15:09

Christian Bekker