False positive nullability warning for generic API that's not nullable aware
Open
Area-Compilers
Feature - Nullable Reference Types
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
csproj:
```xml
net10.0
```
Class1.cs:
```csharp
#nullable enable
namespace ClassLibrary2
{
public class Class1
{
public static void M(T? p, I i)
{
_ = i.M1(p);
_ = i.M2(p);
}
}
}
#nullable disable
public interface I
{
bool M1(T x);
bool M2(object x);
}
```
Produces:
```
Class1.cs(8,22,8,23): warning CS8604: Possible null reference argument for parameter 'x' in 'bool I.M1(T x)'.
```
I'm not expecting the warning because the API is not nullable aware. Note that only M1 is producing warning. M2 is correctly not producing any warnings.
Contributor guide
Assessment
This issue has not been assessed yet.