Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable all Resharper warnings with a comment

Tags:

c#

resharper

Is there a way to disable all Resharper warnings for a file or section of code with a single comment? I'm trying to create some coding exercises for interviewing potential candidates, and the Resharper warnings give away the problem I want the candidate to spot :P Suppressing the specific warning still makes it obvious what the problem is.

I still want to have Resharper available during the interview, I just want the candidate to spot this problem without Resharper spoiling the fun.

edit: Sorry I'll try to be more clear about what I'm after. I don't want to permanently disable a particular Resharper warning, I just want it to not show in one particular file, because the point of the exercise is to see if the developer understands the reason for the warning.

To give one example, there is a Resharper warning to use the .Any extension method instead of Count() > 0, which I want the developer to point out themselves. To disable that warning, you have to use a comment of:

// ReSharper disable UseMethodAny.0 

around the code. That kind of gives the game away a little.

I was trying to find something like:

// ReSharper disable all 

which I could place at the top of the class, so it won't give away what I want the developer to find. But I can't seem to find a way to do that. Using numbers for the Resharper warnings would be fine as well, but I don't think it works that way?

like image 833
Niall Connaughton Avatar asked Jan 13 '12 17:01

Niall Connaughton


People also ask

In which form Jetbrains ReSharper presents all issues and errors?

ReSharper is capable of detecting errors not only in plain C# or VB.NET code, but in ASP.NET code-behind files, references in markup files, and ASP.NET MVC calls.

How do I optimize ReSharper?

Open Visual Studio options (Tools | Options) and configure the preferences as follows: Environment | General: disable Automatically adjust visual experience based on client performance, disable Enable rich client visual experience, enable Use hardware graphics acceleration if available.


1 Answers

You can press Ctrl + Shift + Alt + 8 to disable analyses and highlightings in the current file.

like image 155
derigel Avatar answered Sep 22 '22 11:09

derigel