Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 443 Bytes

PH_B014.md

File metadata and controls

9 lines (5 loc) · 443 Bytes

PH_B014 - Await On Conditional Access

Problem

A conditional access with ? to a type member or a cast with as means that the value may be null. However, the access result is asynchronously awaited using the await keyword, although null cannot be awaited and ends in a System.NullReferenceException.

Solution

Guard the await using an if-statement or reconsider that possibility if this particular member can be null.