resharper

Resharper 8 - Quickfix shortcut Alt+Enter gone

a 夏天 提交于 2019-12-18 10:04:44
问题 In Visual Studio 2012/2013, I want to reassign the Alt + Enter ↵ key combination to the "Quickfix" (triggering the menu from the light bulb) because it is not working anymore. I can't. I have tried the following (I am aware that some of the suggestions refer to VS 2010 and older R# versions): Tried to change manually in Tools - Options - Keyboard : the former ReSharper_QuickFix entry is gone, see ReSharper_QuickFix gone Tried Resharper_AltEnter as suggested in What is the name of the

How to disable /* autocomplete in Visual Studio 2012 (or Resharper)

三世轮回 提交于 2019-12-18 07:32:24
问题 I have Visual Studio 2012 with Resharper installed. When editing css files, when I type /* , I get autocompletion like so: /**/ I would like to disable that , but I cannot find it in the options menu. Where can I disable that? Thank you! 回答1: One way to avoid this annoyance is to add the closing comment symbols first. 回答2: Go to tools -> options -> text editor -> all languages(or chose one), and untick Automatic brace completion . You can also search for it in options menu. 来源: https:/

NullReferenceException with object initializer suggested by resharper

为君一笑 提交于 2019-12-18 06:58:56
问题 I have a strange issue with the object initializer syntax. Here are my sample classes: public class Foo { public Bah BahProp { get; set; } } public class Bah { public int Id { get; set; } } Consider following three ways to initialize an object: The old, verbose but explicit way, working correctly: var foo1 = new Foo(); foo1.BahProp = new Bah(); foo1.BahProp.Id = 1; // correctly initialized The second way i'm always using, using object initializer syntax: var foo2 = new Foo { BahProp = new Bah

custom code snippets in intellisense

爷,独闯天下 提交于 2019-12-18 04:45:08
问题 I've started exporting some of my frequently used blocks of code to custom snippets. Is there a way to get these to show up in IntelliSense and not have to use the snippet browser from the context menu or snippet manager? At first, I thought this was related to ReSharper, but they still don't show up when I disable the ReSharper IntelliSense. It would be nice to be able to just use the snippet shortcut instead of using the browser. 回答1: You need to set the ShortCut property like <Shortcut

Is there a way to keep ReSharper from formatting a region of code

家住魔仙堡 提交于 2019-12-18 04:35:19
问题 I use ReSharper's code cleanup all the time, but sometimes I have code formatted in a way that makes it easier to read than ReSharper's formatter makes it. Is there a way to mark part of your file with comments or something to make it skip formatting that portion. (I'm not talking about inspections, I know how to have ReSharper ignore regions for inspections) 回答1: I had a discussion with Resharper support about this, their answer: Thank you very much for this information! We will discuss if

Can Visual Studio tell me which reference threw a NullReferenceException?

喜你入骨 提交于 2019-12-18 04:05:49
问题 I'm writing unit tests for an MVC web app, and I've been getting null reference exceptions because the mocked-up test objects are only partly initialized. I know which line is throwing the exceptions, and it looks something like this: return Supervisor.RegistrationInformation.Registrations .Any(r => r.RegistrationCountry.IsUSAOrCandada() && (!DatesWorked.Start.HasValue || r.RegistrationDate <= DatesWorked.Start.Value) && (!DatesWorked.End.HasValue || r.RegistrationExpirationDate >=

Fastest way to update namespaces with ReSharper?

帅比萌擦擦* 提交于 2019-12-18 03:00:10
问题 I have been doing some refactoring and reorganization and I have moved a bunch of files around. I want to update each file so it has the "correct" namespace according to its new location. With ReSharper, I can go into each file and it shows me that the namespaces is incorrect but that way I have to do it each file at a time. Is there anyway to update namespaces across every file in a folder or a project? 回答1: UPDATE: Anyone reading this question with R#5.0 and above should note that this is

Why should I use var instead of a type? [duplicate]

落花浮王杯 提交于 2019-12-17 23:36:14
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: ReSharper and var After I have installed ReSharper it demands(by warnings) that I use var whenever possible, for example UnhandledExceptionEventArgs ue = (UnhandledExceptionEventArgs) t; ReSharper wants to turn it into var ue = (UnhandledExceptionEventArgs) t; I like the first version better, is there any reason to prefer var ? better performance? anything? or is it just a code style? 回答1: It's really just a

TODO comment font color in VS2010 with ReSharper and Productivity Power Tools

梦想与她 提交于 2019-12-17 22:19:35
问题 I just installed the Productivity Power Tools for Visual Studio 2010. I also have ReSharper installed. Prior to the PowerTools installation, my TODO comments (i.e. // TODO: Do Something ) were showing up in the code using the font listed under VS options as "Resharper Todo Item". Now it's a dark blue color, and apparently ignoring the setting in the VS options. I'm using a dark theme, so I can barely read these comments. I've dug through all the options I can find (all of the options in VS

ReSharper warns: “Static field in generic type”

和自甴很熟 提交于 2019-12-17 22:07:44
问题 public class EnumRouteConstraint<T> : IRouteConstraint where T : struct { private static readonly Lazy<HashSet<string>> _enumNames; // <-- static EnumRouteConstraint() { if (!typeof(T).IsEnum) { throw new ArgumentException( Resources.Error.EnumRouteConstraint.FormatWith(typeof(T).FullName)); } string[] names = Enum.GetNames(typeof(T)); _enumNames = new Lazy<HashSet<string>>(() => new HashSet<string> ( names.Select(name => name), StringComparer.InvariantCultureIgnoreCase )); } public bool