ReSharper shows warning errors after upgrading to version 1.0.0
gyulakrizsma opened this issue · 1 comments
Hi there,
I have updated our projects to use the latest version of MiniGuard => 1.0.0.
Then suddenly we started to have these warning all over our solution:
That is R#'s Possible NullReferenceException
I have checked that you are using JetBrains.Annotations
in this version. Is there anything I should setup in R# config maybe?
Thanks!
As a follow up I have found a solution which works on my local machine based on this article:
https://resharper-support.jetbrains.com/hc/en-us/community/posts/115000349164-JetBrains-Annotations-not-working-from-referenced-NuGet-package
As a TLDR: JETBRAINS_ANNOTATIONS
This needs to be added to the project, cause without this, consuming the package as a NuGet package or as a NON solution reference removes the annotations, which causes issues.
So what I have done is that I have downloaded the source code, added those changes mentioned in the article and then added the modified MiniGuard reference as an external reference in to our libraries and the annotations were present and the null reference R# warnings disappeared.
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;JETBRAINS_ANNOTATIONS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;JETBRAINS_ANNOTATIONS</DefineConstants>
</PropertyGroup>
As a side note, maybe updating the JetBrains.Annotations
would be beneficial. I haven't tested that though.
Please let me know how to proceed with the issue. Should I create a PR or you make the change?
Many thanks and have a good day