I lean quite heavily on Resharper context actions to generate boilerplate code. The Check parameter for null context action had, up until recently, generated code that performs the null check and throws accordingly. However, now it is adding a Resharper specific [NotNull]
annotation to the parameter as part of the method signature.
Looking at this related question Stop ReSharper from Adding Annotations, I've checked across my solution codebase for jetbrains.annotations.dll
references but not found any.
However, searching across all files I've found references to jetbrains.annotations.dll
in the xml documentation file for NodaTime (NodaTime.xml).
Specifically, entries like this:
<member name="T:JetBrains.Annotations.NotNullAttribute">
.
Im not categorically stating that this is the root cause. However, NodaTime is the most recent nuget package I have added since the issue began, and a grep across the solution shows this to be the single point of reference.
Should xml documentation files be including these references, and if so, is there a way for me to configure Resharper to ignore them?
UPDATE I've decompiled the NodaTime assembly and although it doesn't have any binary references to jetbrains.annotations.dll it does appear to (re)declare the offending JetBrains.Annotations namespaces and annotations within itself.
As per citizenmatts suggestion, Ive used the Resharper take me to definition tool for the [NotNull]
attribute and this goes to the NodaTime.dll
I've also just noticed that the NotNull
attributes Resharper is including do not compile and complain of Cannot reference internal class NotNullAttribute
. Hence I obviously don't have the jetbrains.annotations.dll included anyway.
UPDATE 2
Just done the obvious thing of creating a new blank project in VS2013 and checking the null check context action in Resharper works. Then added NodaTime nuget package and rechecked - and indeed it adds the [NotNull]
attribute and the project wont compile.
UPDATE 3 As suggested by Jon Skeet I've tried "turning off" data annotations using Resharper-->Code Inspection-->Code Annotations-->Unticking JetBrains.Annotations. However, this has no affect and the NotNull attribute continues to be included.
Looks like I may just have to return to System.DateTime.