Christian Bekker
Christian Bekker

Reputation: 1867

TaskAwaiter cannot be inferred from the usage

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;
}

Upvotes: 13

Views: 507

Answers (1)

Christian Bekker
Christian Bekker

Reputation: 1867

Updated resharper to latest version, solved issue

Upvotes: 3

Related Questions