resharper

Any way to surround code block with Curly Braces {} in VS2008?

自古美人都是妖i 提交于 2019-11-30 10:54:00
问题 I always find myself needing to enclose a block of code in curly braces { } , but unfortunately that isn't included in the C# surround code snippets, which seems to be an oversight. I couldn't find anything on building your own surround snippets either (just other kinds of snippets). I am actually running Resharper too, but it doesn't seem to have this functionality either (or I haven't figured how to activate it). We have a coding standard of including even a single line of code after an if

Keyboard shortcut to close all tabs but current one in Visual Studio?

ⅰ亾dé卋堺 提交于 2019-11-30 10:53:38
问题 Does anyone know a keyboard shortcut to close all tabs except for the current one in Visual Studio? And while we're at it, the shortcut for closing all tabs? Is there a Resharper option for this? I've looked in the past and have never been able to find it. 回答1: I don't think there is one by default, but you can go to Tools>Options>Environment>Keyboard and bind a key to File.CloseAllButThis. I use ctrl + alt + w 回答2: By default, the command File.CloseAllButThis does not have a keyboard binding

Resharper: Possible null assignment to entity marked with notnull attribute

你。 提交于 2019-11-30 10:48:42
I get this warning on response.GetResponseStream() How should I handle this? // Get response using (var response = request.GetResponse() as HttpWebResponse) { // Get the response stream if (response != null) { var reader = new StreamReader(response.GetResponseStream()); var responseString = reader.ReadToEnd(); return responseString; } } For clarity based on some answers misinterpreting : This line is not where the warning is occurring: using (var response = request.GetResponse() as HttpWebResponse) This line is where the warning is occurring: var reader = new StreamReader(response

Resharper closing parenthesis indentation on function with multiple arguments

与世无争的帅哥 提交于 2019-11-30 08:53:22
I have some lines of code in c# that Resharper indents like this: Console.WriteLine("Hello"); this.MySuperFunction( argument1, argument2, argument3 ); Console.WriteLine("World"); Due to my personal coding style, I would like the above to appear with the closing parenthesis (or brace) without any indentation, like so: Console.WriteLine("Hello"); this.MySuperFunction( argument1, argument2, argument3 ); Console.WriteLine("World"); I tried playing with the various options on Resharper, but couldn't find any. Is there a way I can make this work? Update to 2016.2 version. An option Intent method

How can you force StyleCop for ReSharper to ignore files?

别等时光非礼了梦想. 提交于 2019-11-30 08:38:43
We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components included in the project. What this means is your site wide code analysis in ReSharper always shows up errors and you can never get it to go “green”. There’s always the ExcludeFromStyleCop tag which you can put in the .csproj but this is only used by MSBuild.

How to get multiline TODO's in Resharper 8

半腔热情 提交于 2019-11-30 08:35:26
I have be trying to figure out how to change the regular expression in the Options -> To-Do's in resharper to color code and allow for multiple lines in a todo. Any Ideas? I figured out the answer, easier than I thought Orignal regex for todo's in resharper (?<=\W|^)(?TODO)(\W|$)(.*) It is possible to do this using just regex... Go into Resharper -> Options -> To-Do Items and change the existing regex to (?s)(?<=\W|^)(?<TAG>TODO)(\W|$)(.*) The (?s) option allows for mutliline TODO's The format of the todo is /* TODO: a Multiline * to do list must use the block comment style * though it will

Solving the 'Virtual method call in constructor' issue

筅森魡賤 提交于 2019-11-30 08:26:00
I am making a software in c#. I am using an abstract class, Instruction , that has these bits of code: protected Instruction(InstructionSet instructionSet, ExpressionElement newArgument, bool newDoesUseArgument, int newDefaultArgument, int newCostInBytes, bool newDoesUseRealInstruction) { //Some stuff if (DoesUseRealInstruction) { //The warning appears here. RealInstruction = GetRealInstruction(instructionSet, Argument); } } and public virtual Instruction GetRealInstruction(InstructionSet instructionSet, ExpressionElement argument) { throw new NotImplementedException("Real instruction not

Resharper 7.1 Solution Analysis False Errors

旧街凉风 提交于 2019-11-30 08:17:39
In our VS2012 web project we are getting hundreds of errors reported by Resharper, but the software builds and compiles fine. How do I get resharper to correctly identify the fact that the solution is actually fine. All the errors are about properties on classes are not found. I have tried cleaning the solution and forcing Resharper to re-analyze. Ciprian Khlud Resharper gets confused for many reasons, but some of the times I had issues the solutions I did were: like this case disable Resharper for a set of files: Resharper => Options => Code Inspection =>Settings => Edit Items to Skip

How to stop ReSharper removing spaces in object initializer

ε祈祈猫儿з 提交于 2019-11-30 07:51:49
I like my object initializers to look like this: new Point { Label = g.Key.Name, Claims = g }; When hit the semicolon key, they get reformatted like this: new Point {Label = g.Key.Name, Claims = g}; Where is the option to stop my padding from being removed? For R# 7, I can get this to vary by going to 1 ReSharper | Options | Code Editing | C# | Formatting Style | Spaces and toggling Other | Within single-line initializer braces the example for which is int[] x = new int[] {0, 1, 2}; versus int[] x = new int[] { 0, 1, 2 }; Although the example is of array initialization, it also appears to

Ambiguous references with the exact same namespace

余生长醉 提交于 2019-11-30 07:48:55
The RC class is not linked to a database, it is a simple class. The class is at only one place and is not partial. The Aérochem.Domain dll project compiles just fine. Note: If I select one of the two identical namespaces in the quick fix menu, it does nothing. Note2: This happens to a couple of classes (some related to a database, some not) Is there a fix to that or a way to figure what's wrong? I had the same problem. I use ReSharper. The solution to my problem was not cleaning the solution but deleting the suo -file. Hope that helps. chiccodoro As for the reference of any future users: This