Open KryuchkovAlexandr opened 1 year ago
I just came here to report a very similar bug, but it seems to boil down to the same thing:
internal static class Program
{
private static void Main()
{
ThrowIfNull((string?)null, out _); // CS8634
}
private static void ThrowIfNull<T>(T? input, out T output) where T : class
{
output = input ?? throw new ArgumentNullException(nameof(input));
}
}
input
is changed to type T
, and the argument changed to ""
.
Version Used: Visual Studio 2022 v17.6.4, .NET7
Steps to Reproduce:
Diagnostic Id: CS8631, CS8634
Expected Behavior: No warnings.
Actual Behavior: Using discards triggers CS8631 and CS8634.