Zor's Blog
Seeing Sharp

ReSharper and Code Contracts

I just ran into this today. It makes ReSharper shut up about possible null references when you use Code Contracts in your C#/VB projects.

The XML file provided there is not complete, however. I’ve added the ContractInvariantMethodAttribute and ContractClassForAttribute attributes to the annotations so that ReSharper won’t claim that your contract classes and invariant methods are unused.

The XML is here.

Just drop this into C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\ExternalAnnotations\mscorlib as Microsoft.Contracts.xml or so.

Advertisement

2 Responses to “ReSharper and Code Contracts”

  1. Free graphics, 3d, code snippets, PHP, HTML, JavaScript and more!…

    [...]ReSharper and Code Contracts « Zor's Blog[...]…

  2. Money Maker…

    [...]ReSharper and Code Contracts « Zor's Blog[...]…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.