How do I get ReSharper Code Inspection to recognize our assert method is preventing a possible System.NullReferenceException?
We are inundated with false "possible System.NullReferenceException" warnings
because ReSharper code inspection has no way to determine that our assert
method is preventing invalid use of null.
Here's a sample assert we use to simplify and clarify method parameter checking.
There are other overloads as you'd expect:
static class Guard
{
public static void AgainstNull(T
value)" methods to return "value", and then do
arg1 = Guard.AgainstNull(arg1, "arg1")
but that has too much code smell.
Thanks,
EdHow do I get ReSharper Code Inspection to recognize our assert method is
preventing a possible System.NullReferenceException?
Please sign in to leave a comment.
Hello Ed,
You can mark your method with AssertionMethod attribute from external annotations.
For more information please see http://www.jetbrains.com/resharper/webhelp/Code_Analysis__External_Annotations.html.
Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"