Examples of errors detected by the V3168 diagnostic
V3168. Awaiting on expression with potential null value can lead to throwing of 'NullReferenceException'.
Files
V3168 Awaiting on the 'overload?.InvokeAsync(actionInstance.Context)' expression with potential null value can lead to NullReferenceException. Files.App NavigationToolbar.xaml.cs 214
private async void Omnibar_QuerySubmitted(....)
{
....
if (action is not null)
{
var overload = action.GetOverloads().FirstOrDefault();
await overload?.InvokeAsync(actionInstance.Context);
}
....
}
BTCPay Server
V3168 Awaiting on expression with potential null value can lead to NullReferenceException. InvoiceWatcher.cs 383
private async Task<bool> UpdateConfirmationCount(InvoiceEntity invoice)
{
....
var transactionResult = await _explorerClientProvider.GetExplorerClient(
payment.GetCryptoCode())?.GetTransactionAsync(....);
....
}