<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Davepoint &#187; ReSharper</title>
	<atom:link href="http://blog.ceredir.com/index.php/tag/resharper/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ceredir.com</link>
	<description></description>
	<lastBuildDate>Tue, 21 Sep 2010 14:19:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ReSharper and Microsoft Code Contracts</title>
		<link>http://blog.ceredir.com/index.php/2010/01/27/resharper-and-microsoft-code-contracts/</link>
		<comments>http://blog.ceredir.com/index.php/2010/01/27/resharper-and-microsoft-code-contracts/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 13:05:00 +0000</pubDate>
		<dc:creator>David Bending</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code Contracts]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[ReSharper]]></category>

		<guid isPermaLink="false">http://blog.ceredir.com/?p=62</guid>
		<description><![CDATA[I&#8217;m using code contracts in an MVC RC / .NET 3.5 application and I don&#8217;t want ReSharper 5 complaining about potential null reference accesses that aren&#8217;t in fact possible due to the contracts.
The solution (pieced together from StackOverflow and JetBrains) is to add the following XML to a file named C:\Program Files\JetBrains\ReSharper\v5.0\Bin\ExternalAnnotations\Microsoft.Contracts\Microsoft.Contracts.xml.

&#60;assembly name="Microsoft.Contracts"&#62;
  &#60;member [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using code contracts in an MVC RC / .NET 3.5 application and I don&#8217;t want ReSharper 5 complaining about potential null reference accesses that aren&#8217;t in fact possible due to the contracts.</p>
<p>The solution (pieced together from <a title="Stack Overflow" href="http://stackoverflow.com/questions/929859/resharper-possible-null-assignment-when-using-microsoft-contracts">StackOverflow</a> and <a title="JetBrains" href="http://www.jetbrains.net/devnet/thread/283808">JetBrains</a>) is to add the following XML to a file named C:\Program Files\JetBrains\ReSharper\v5.0\Bin\ExternalAnnotations\Microsoft.Contracts\Microsoft.Contracts.xml.</p>
<pre class="brush:xml">
&lt;assembly name="Microsoft.Contracts"&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
    &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean,System.String)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean,System.String)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean,System.String)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
  &lt;member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean)"&gt;
    &lt;attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/&gt;
    &lt;parameter name="condition"&gt;
      &lt;attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"&gt;
        &lt;argument&gt;0&lt;/argument&gt;
      &lt;/attribute&gt;
    &lt;/parameter&gt;
  &lt;/member&gt;
&lt;/assembly&gt;
</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.ceredir.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.ceredir.com/index.php/2010/01/27/resharper-and-microsoft-code-contracts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

