Impossible to satisfy R#
I have a class which implements IFormattable. No matter what I do, R# complains about the provider parameter.
Starting with:
public string ToString(string format, IFormatProvider formatProvider = null)
R# complains that I need to add [CanBeNull] to the parameter:

If I accept that suggestion, I get:
public string ToString(string format, [CanBeNull] IFormatProvider formatProvider = null)
and R# now complains that the base declaration has the same annotation:

I'm also seeing the same problem with implementing IValidatableObject - R# wants me to annotate the Validate method with [ItemCanBeNull], then complains that the base declaration has the same annotation.
And the same problem implementing a Newtonsoft JsonConverter that I reported two years ago, which is still "triaged" and not fixed.
R# 2023.1
VS2022 v17.5.3
Please sign in to leave a comment.
thank you for your feedback.
We'll take care of the issue.
Could you please also specify why you still use "Declaration nullability is inferred" together with JetBrains annotations? It seems that this functionality is outdated since "Nullable Reference Types" were introduced.
Thank you.
I'm writing code that targets .NET Framework, where NRT is practically unusable - the nullable analysis attributes aren't defined, and none of the BCL was compiled with nullable annotations enabled.
We'll try to fix the issue in the near future.
Please follow the updates of the YT issue - https://youtrack.jetbrains.com/issue/RSRP-485421.