-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Description
Version Used:
Visual Studio 18.1.1
C# Tools 5.0.0-2.25574.6
Steps to Reproduce:
internal class DoubleTryGetTest
{
public static void Test()
{
if (TryGet1(out object? o))
{
string? s = o.ToString(); // null reference exception produced here.
}
}
private static bool TryGet1([NotNullWhen(true)] out object? o)
{
return TryGet2(out o); // no warning
}
private static bool TryGet2(out object? o)
{
o = null;
return true;
}
}Expected Behavior:
I expect CS8620 to be made somewhere in this code - likely in the body of TryGet1.
Actual Behavior:
No warning is made.
Reactions are currently unavailable