WiseTechGlobal / WTG.Analyzers

Analyzers from WiseTech Global to enforce our styles, behaviours, and prevent common mistakes.
Other
16 stars 3 forks source link

WTG1013 does not correctly identify tuple types when nullable. #158

Closed brian-reichle closed 2 years ago

brian-reichle commented 3 years ago

WTG1013 will correctly detect that this method exposes a tuple type:

public static Tuple<string> Foo() => Tuple.Create("foo"); // correctly warns.

but when the tuple type is made nullable, WTG1013 will no longer detect it.

public static Tuple<string>? Foo() => Tuple.Create("foo"); // should warn, but doesn't.

WI00479696

yaakov-h commented 2 years ago

Error: CS0453: The type 'Tuple<string, string>' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable'

I don't think we can test this until we upgrade Roslyn... at least for the test framework, if not the analyser assemblies.