I am going through the process of converting my .Net 4.8 (not Core!) projects to use the new C# 8 "nullable reference" feature.
To do so, I am changing each source code file in turn by adding
#nullable enable and decorating all nullable references with a
? suffix. This allows me to convert all my code in a piecemeal fashion to use the new feature.
Now consider the following method in a source file with
#nullable enable specified:
[CanBeNull] public static string Test([CanBeNull] string arg)
If I type a '?' after either of the
string declarations (in order to use the new C# 8 "nullable" feature), Resharper removes the
public static string? Test(string? arg)
However, if that attribute is removed then Resharper does not warn me about possible null-reference uses in other source files. (This would not be an issue if all the source files had
#nullable enable specified, but because I am converting the files in a piecemeal fashion, there are many files that do not yet have
#nullable enable specified, so the compiler will not warn me about possible null-reference uses - and neither will Resharper, because the
[CanBeNull] was removed.)
So my question is this:
Is there a way of stopping Resharper from removing the
[CanBeNull] attribute when I type a
? at the end of a reference type name?
I've searched through all the Resharper options but I haven't managed to find one for this.