resharper

Resharper and Code Contracts not playing well together

I'm using Resharper 5.x to do compile-time analysis and it's usually pretty good about it, but it doesn't seem to be applying code contracts to its logic. I have something like the following, but I'm getting an issue on the marked line. public void Method(int arg) { Contract.Requires(this.NullableValueType != null); this.Method...

How to correctly paste HTML into C# code with Visual Studio or Resharper (or any other tool!) ?

Is there any way to make a "safe" paste into Visual Studio (C#) of HTML code? If I try to paste something like <div class="user-info"><div class="user-action-time">answered <span title="2010-09-16 02:23:16Z" class="relativetime">21 mins ago</span> into my code, C# will cry. Using the @ operator doesn't help us, either. Is it possible...

How does one set Visual Studio 2010 keyboard shortcuts comfortably, esp. when using Resharper?

In every Visual Studio.NET version you can set keyboard shortcuts using "Tools - Options - Environment - Keyboard" and then find the command you want to assign a shortcut to by entering part of it in "Show commands containing". For one thing, the listbox is ridiculously short and hard to navigate - does anyone know an alternative? Then...

Visual Studio/ReSharper: How to wrap long lines with commas before params?

I've been customizing my formatting desires using ReSharper for code clean-up. So far I've been able to make the clean-up rules match my coding style within:      ReSharper -> Options -> Languages -> C# -> Formatting Style One thing I haven't figured out how to do yet is how to have params/fields/list items wrap with leading commas inst...

MSpec and ReSharper Problem

I've got the latest mspec from the codebetter teamcity site and installed the Resharper5.1 runner as suggested. The runner and the annotations show up fine in the resharper option dialogs. Now even with the annotations library ticked I still get "field xxx is never used" warnings everywhere and when I ask resharper to run all tests in ...

Resharper bug when referencing silverlight assembly from CLR class library

I'm starting with a new application using silverlight and the first problem I have with Resharper is in my unit test project. My configuration is: -> Resharper 5.1.1727.12 -> MyProject.Tests (CLR 4.0) nunit.framework.dll (CLR 2.0) moq.dll (CLR 4.0) MyProject.Silverlight (Silverlight 4.0) The test project compiles, no errors and th...

Can ReSharper properly parse SharePoint layouts?

I am creating a SharePoint 2010 feature in Visual Studio 2010. While ReSharper is a valuable tool for writing code, it reports lots of errors (all server-relative image references, master page reference, ContentPlaceHolderID's referring to the master page and so on) in .aspx layout definitions. I had to exclude the master page from ReSha...

Use var operator instead of class type

I use resharper in Visual Studio. Every time when I create class instance resharper suggest me to use var instead of exact type of class. Why using var operator more appropriate? ...

Quick way to remove surrounding backet/parenthese/block in Visual Studio 2010 + Resharper ? (Reverse surround with)

Is there something that can do reverse "surround with"? From: ((Type)myobject); To: (Type)myobject; From: if/while/try/using... { lots of code here.... } To: lots of code here.... ...

Resharper indentation

How do I change the basic Resharper indentation options? I have noticed that Resharper's indentation settings differ from VS 2010's--VS uses four spaces for an indent, and it's hard to tell what Resharper uses--but the left margins on my code are jagged. I'd like to reset Resharper to use the same settings as VS 2010, but I can't find t...

Cannot run mspec.exe with Syste.Data.SQLite.dll x86, but it works in R# MSpec runner

Hi, I use mspec for my tests and have a NHiernate Setup using SQLite x86 for my database in the tests. The problem is that when i run my test using the mspec r# runner everything works fine but running it from the console thwors an error that it cannot find the sqlite dll. My config of the specification projects: .net 4 x86 (using th...

Visual Studio 2010 Slow to Load

I have been happily using VS 2010 for several weeks without any performance problems. I installed dotCover from JetBrains several days ago and things continued to run well, but ran my first code coverage test earlier today. I double clicked on one of the report results and it successfully took me to the referenced line of code. I inadv...

Resharper scripting (with custom actions)

I have a large number of auto-generated (from XML) classes that also can contain some manually added members. When doing it's work, the generator would only add new members to the file, and leave the rest alone. Now I've decided to split the class to two files. One containing auto-generated content, and other containing manual members an...

Best way to handle a NULL

At the top of my functions I'm trying the best way to handle a null coming into my procedures in C#. Which is the best way for checking and handling the null and why? I've added the complete code of what I'm using right now and Resharper is telling me to use Option #1. Normally I do what it says as I understand why it makes it more effic...

style cop + resharper control comments

this may seem like a trivial question but when i installed the stylecop plugin for resharper my comments are getting formatted like this /// <summary> /// Gets the gift item. /// </summary> /// <param name="uid"> /// The uid. /// </param> /// <param name="upc"> /// The upc. /// </param> /// <returns> /// </returns> Gift GetGift(long uid...

regex to pull out strings inside #if debug #endif block

Hi I have an application with a large number of #if debug blocks which kind of look like the the one below: #if DEBUG Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("oldXml: " + oldXml.OuterXml); Logging.Log("XmlDiff: " + diff_sb.ToString()); ...

Does "var" keyword hampers code readability?

I just started using Resharper. One of its features is that it suggests changes to the code based on, i suppose, good coding practices. One of the changes it suggested is to change the variable type to var during assignment. I kept on changing and now the code has var everywhere. Somehow I get the feeling that "var" keyword makes the c...

Can Resharper (or Visual Studio) collapse a method call (replace the call with the contents of that method/constant)?

I've inherited a web application written in ASP.NET that has an incomplete implementation of a localization scheme (not using resource files). Here's a micro version: public class Useful { public void DoSomething() { return Localizations.Do_Something_Message_vx7Hds8i; } } public class Localizations { public cons...

Should a local const variable start with Upper or lower casing

Got a style conflict between StyleCop and Resharper. Stylecop 1303 says that const vars should start uppercase and I agree. Resharper says OK for class-wide const declarations, but when using a const in a local (e.g. method) scope, Reshaper doesn't approve and wants to make everything camelCasing. Of course no problem to disable this r...

What Resharper features should be highlighted?

Hello everybody! On next week I will be talking in front of my colleagues about Resharper as a tool which improves developers' performance. Because time for this talk is limited the question is - what resharper features are worth to be spoken about more then the others? At the moment I can think of: code analisys/highlight unittest r...