Why are my Assert.IsNotNull MSTests not recognized?
I am using MSTest as my unit test framework. I am wondering why I get a "possible NullReferenceException" from ReSharper after an Assert.IsNotNull check.
Example:
Assert.IsNotNull(expected);
var type = expected.GetType();
expected get's marked as possible NullReferenceException in the second line.
In my ExternalAnnotations folder I have a folder named Microsoft.VisualStudio.QualityTools.UnitTestFramework with a file Microsoft.VisualStudio.QualityTools.UnitTestFramework.xml
This files contains (among other stuff):
<member name="M:Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(System.Object)">
<attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/>
<parameter name="value">
<attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)">
<argument>3</argument>
</attribute>
</parameter>
</member>
Shouldn't this prevent ReSharper from showing the warning?
Am I missing something?
I am using ReSharper Build 6.0.2202.688 with Visual Studio 10.0.40219.1
Please sign in to leave a comment.
I just made this additional observation:
In the above code, neither actual or expected is underlined with the possible NullReferenceException warning, but in the following code I get the warning for both actual and expected. (The double-checks for null are intentional here).
It smells a bit like a bug.