resharper

Is there a way to disable ReSharper for a specific file?

你离开我真会死。 提交于 2019-11-27 10:40:30
问题 I want to tell ReSharper to ignore a few files in my project. Some of them are just too large (they contain canned test data). Some of them are just confusing it (with a mishmash of Silverlight and .NET code). Is there a way to do this by putting a comment at the top of the file? However it's done, it needs to be persistent (i.e. can be checked in), and per-file. I found this, but it doesn't appear to be persisted. 回答1: In order to skip inspections in some files or folders go to ReSharper |

Visual Studio 2012: change setting for “Enable floating tab wells”

南笙酒味 提交于 2019-11-27 10:32:03
问题 I'm having troubles with VS2012 and code opened in separate windows. See this screenshot: Main windows is open, another window is open (Source Control explorer is just an example for the screenshot, I get the same behavior with source code files). I used to get two items on the task bar for the Visual Studio. Now it is only one. There is a setting for this: But I can't get it undone. Every time I un-check this setting, I get a flicker of another item in task bar, but it goes away immediately.

ReSharper - Possible Null Assignment when using Microsoft.Contracts

笑着哭i 提交于 2019-11-27 10:19:47
Is there any way to indicate to ReSharper that a null reference won't occur because of Design-by-Contract Requires checking? For example, the following code will raise the warning ( Possible 'null' assignment to entity marked with 'NotNull' attribute ) in ReSharper on lines 7 and 8: private Dictionary<string, string> _Lookup = new Dictionary<string, string>(); public void Foo(string s) { Contract.Requires(!String.IsNullOrEmpty(s)); if (_Lookup.ContainsKey(s)) _Lookup.Remove(s); } What is really odd is that if you remove the Contract.Requires(...) line, the ReSharper message goes away. Update I

Can Resharper be set to warn if IDisposable not handled correctly?

一曲冷凌霜 提交于 2019-11-27 09:00:47
Is there a setting in Resharper 4 (or even Visual Studio itself...) that forces a warning if I forget to wrap code in a using block, or ommit the proper Dispose call in a finally block? Correct automatic Dispose analysis requires DFA (Data Flow Analysis) in a global way. It is unlikely that you create an IDisposable object and doesn't call any method on it and do not pass it around as an argument. If disposable object is passed to other methods (including calling its members, when "this" is implicitly passed), the tool should analyse if Dispose is not called within, or that object is not

Resharper runs UnitTest from different location

爱⌒轻易说出口 提交于 2019-11-27 08:48:27
When I run unit tests with Visual Studio it works fine, because it runs from project directory where all assemblies are. But when I run it with resharper it goes with error on var services = Assembly.Load("SomeAssembly"); with error Could not load file or assembly 'SomeAssembly' or one of its dependencies. The system cannot find the file specified.. So i've tried var path = Assembly.GetExecutingAssembly().Location; and it's not project one. It's C:\Users\*UserName*\AppData\Local\Temp\TestResults\...\Out\ and there is no 'SomeAssembly' . How do I configure resharper correctly or collect all

Resharper: vars

眉间皱痕 提交于 2019-11-27 08:03:40
Why does Resharper want you to change most variables to var type instead of the actual type in the code? It's just an option. You can disable it: ReSharper -> Options -> Code Inspection -> Inspection Severity -> Code Redundencies -> Use 'var' keyword where possible: change this to "Do not show" There's also the context (lightbulb) option which will take you in each direction - this is under ReSharper -> Options -> Languages -> C# -> Context Actions -> "Replaces explicit type declaration with 'var'" I saw a video from Hadi Hariri, where he was presenting Resharper 6.x. His reasoning was, if you

ReSharper Unit Test Runner: Support for Deployment Items

痴心易碎 提交于 2019-11-27 06:50:32
问题 I like the Unit test runner in ReSharper 4.5, and would like to use it with my MSTest tests, but one thing annoys me: In some of our solutions, we have set up some Deployment Items in the .testrunconfig file. The ReSharper Unit Test runner does not seem to respect this, so I get errors when trying to run the unit tests from ReSharper. Is there any workraound for this ? Update: citizenmatt 's answer was correct, the option to use a .testrunconfig with ReSharper exists in the Options dialog of

ReSharper: how to remove “Possible 'System.NullReferenceException'” warning

独自空忆成欢 提交于 2019-11-27 06:43:23
问题 Here is a piece of code: IUser user = managerUser.GetUserById(UserId); if ( user==null ) throw new Exception(...); Quote quote = new Quote(user.FullName, user.Email); Everything is fine here. But if I replace "if" line with the following one: ComponentException<MyUserManagerException>.FailIfTrue(user == null, "Can't find user with Id=" + UserId); where function implementation is following: public abstract class ComponentException<T> : ComponentException where T : ComponentException, new() {

d:DesignInstance with an interface type

馋奶兔 提交于 2019-11-27 06:34:35
问题 I'm binding an UI to an interface (which is implemented by several presenters, not accessible from the UI assembly). I really like d:DesignInstance in designer because it (kind of) makes xaml strongly typed using R#. Sadly, d:DesignInstance does not support interface types: "Cannot create an instance of an interface." The first thing I thought is: Ok, no problem, let's create a custom markup extension which takes a System.Type as parameter, and which ProvideValue method returns a fake

Custom Brace formatting with Resharper

二次信任 提交于 2019-11-27 06:08:24
I'm using Resharper 4.5 and I need custom formatting of braces when writing an array or object initializer. Resharper supports some styles: Gnu Style: int[] array = new int[] { 1, 2, 3 } but I need: int[] array = new int[] { 1, 2, 3 } Is there any way to customize this templates? You can customize ReSharper to do just that, you'll need to do the following (All in ReSharper -> Options -> C# -> Formatting Style ): In Braces Layout , set Array and object initializer to At Next line (BSD Style) . In Other , make sure that Continuous line indent multiplier is set to 1 . In Other , make sure that