dotnet/roslyn
Invalid nullability mismatch warning on generic notnull ref parameter discard
Offen
#82.919 geöffnet am 24.03.2026
Area-CompilersFeature - Nullable Reference Typeshelp wanted
Repository-Metriken
- Stars
- (20.414 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)
Beschreibung
Version Used: 5.6.0-2.26161.119
Steps to Reproduce:
#nullable enable
class Gen<T> where T : notnull
{
public static void Func(ref T t)
{
_ = ref t; // Diagnostic CS8619 here.
}
}
A minimal repro, with source-code provided, is ideal. Most compiler/language issues can be distilled into a snippet that can be pasted into .NET Lab.
Diagnostic Id: CS8619
Expected Behavior: No diagnostic
Actual Behavior: CS8619: Nullability of reference types in value of type 'T' doesn't match target type 'T?'