Wrapping a call with [MaybeNullWhen] results in incorrect compiler warnings #39681
Labels
Area-Compilers
Feature - Nullable Reference Types
Nullable Reference Types
Resolution-Duplicate
The described behavior is tracked in another issue
Version Used:
dotnet sdk 3.0.100
Steps to Reproduce:
dotnet new console
<Nullable>enable
to the .csproj file:[MaybeNullWhen]
attribute that wraps a call to another method using a[MaybeNullWhen]
attribute. Eg:dotnet build
Expected Behavior:
No warnings
Actual Behavior:
Received warning CS8601
I'm not able to find a good workaround without disabling a warning. Using an additional local variable, and then assigning null to the
out
param when returning false, results in a different warning:Results in:
The text was updated successfully, but these errors were encountered: