Value Analysis Assertion Methods
Hi,
I have been trying to add a new assertion method to no avail; I can only think I have done something wrong or left something out.
I have created a VarObj object in the following namespace:
Core.Runtime.VarObj
In this object there is a static IsNullOrEmpty function. The idea of the function is to check for null or empty values effectively.
The usage of this function is as so in code:
if (VarObj.IsNullOrEmpty(var))
{
//Handle somehow
return;
}
I have had an issue with Resharper warning me about a possible NullReferenceException below this code. To avert this I tried inserting an Assertion Method.
The details I have entered into the assertion method are:
Core.Runtime.VarObj.IsNullOrEmpty, paramater # 0, == null
This however does not work correctly in my code; the Possible System.NullReferenceException still occurs.
Is anyone able to point out what I am missing? Thanks for any light you can shed on the issue.
One last point is that this happens within the Core.Runtime assembly and also within assemblies referencing this.
Please sign in to leave a comment.
You should set "!= null"
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"paulnz" <no_reply@jetbrains.com> wrote in message
news:31413482.1202687483672.JavaMail.itn@is.intellij.net...
>
>
>
>
>
>
>
>
>
>
Wow; such a simple answer and it worked. I feel like a twit :)
The reason for my confusion I see now is due to me not thinking properly. I saw Assert.IsNull check for == null and thought that my function checked for it == null also. I didn't think about the fact that Asset.IsNull throws an assertion exception though.... :)
Thanks for your help with this one.