resharper

Resharper debugging a third party decompiled dll

╄→尐↘猪︶ㄣ 提交于 2019-11-28 17:19:03
问题 Is there a way to debug into a decompiled dll using Resharper and if so how do you do this? For example I am trying to debug into System.Web.Http.ApiController where I have decompiled and can see the source. I have set a breakpoint but when I run the application it does not break into decompiled breakpoint when debugging. 回答1: As far as i am aware it is not possible to debug the decompiled .net source code using Resharper (up to v6.1) However, this article explains how you can debug into the

ReSharper warns: “Static field in generic type”

杀马特。学长 韩版系。学妹 提交于 2019-11-28 16:45:56
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 Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values,

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

别来无恙 提交于 2019-11-28 16:35:46
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? Martin Buberl It's really just a coding style. The compiler generates the exact same for both variants. See also here for the performance question: Will using 'var' affect performance? When

ReSharper color identifiers screw up with Visual Studio 2012 dark theme

谁说我不能喝 提交于 2019-11-28 16:12:23
We're experiencing an annoying problem issues with ReSharper's color identifiers feature when Visual Studio 2012 is set to the built-in dark theme. With ReSharper's color identifiers disabled, the code looks fine: Then, we enable ReSharper's color identifiers: And now the code is completly unreadable: The curious thing, on a colleague's machine, the same code, with the same Visual Studio and ReSharper settings... looks right: We tried reinitializing both Visual Studio and ReSharper settings, disabling add-ons and extensions and other voodoos to no avail. Here are our setups: My add-ins - His

Using VS Code Snippets with Resharper

时光总嘲笑我的痴心妄想 提交于 2019-11-28 16:12:11
问题 I am trying to use Code Contract's Code Snippets but since I turned Resharper back on it doesn't recognize them. On the other hand, it is recognizing some snippets I've implemented myself in the past. Any ideia of what might be the problem? I'm specifically trying to use cr and ce , which I think, don't collide with any other snippets (at least from what I see in the intellisense). I'm using R# 5 with VS 2010 Thanks 回答1: Press CTRL + J then type your snippet shortcut... this is mentioned here

Resharper Clean-up Code - how to affect sorting of methods?

半腔热情 提交于 2019-11-28 15:47:39
I've got a customized clean-up and it's almost 'there'. However, R# appears to want to sort the member methods, but at least it does not appear to be alphabetically. Is there a way to force that sorting? James Kolpack Customizing the layout can indeed be accomplished with Resharper. Go to: Resharper->Options->Languages->C#->Formatting Style->Type Members Layout ReSharper 2017 Resharper -> Options-> Code Editing -> C# -> File Layout -> Interface Implementations/All Other Members and uncheck the "Use Default Patterns" option. Now you'll want to edit the xml in the "Custom Patterns" box. I'd

Unable to type in Visual Studio

跟風遠走 提交于 2019-11-28 13:41:11
问题 I am unable to edit any files in a project in Visual Studio 2013. It only happens in one project. If I open a different project I am able to type fine, but once I go back into the problem project I am unable to type in the editor windows. Not sure if it matters but the project that is giving me issues we are using SVN on. The other projects are just local ones on the machine. I have restarted Visual Stuido, restarted the computer and still am unable to edit the files. Any ideas? 回答1: This

How Does Resharper Know “Expression is always true”?

倖福魔咒の 提交于 2019-11-28 13:21:45
Check out the following code: private void Foo(object bar) { Type type = bar.GetType(); if (type != null) // Expression is always true { } } Resharper claims type will never be null . That's obvious to me because there's always going to be a type for bar , but how does Resharper know that? How can it know that the result of a method will never be null . Type is not a struct so it can't be that. And if the method were written by me then the return value could certainly be null (not necessarily GetType, but something else). Is Resharper clever enough to know that for only that particular method

When would SqlCommand.ExecuteReader() return null?

感情迁移 提交于 2019-11-28 13:21:00
When using calling the SqlCommand.ExecuteReader() method, ReSharper tells me I have a possible NullReference exception when I use the SqlDataReader object afterwards. So with the following code: using (SqlConnection connection = GetConnection()) { using (SqlCommand cmd = connection.CreateCommand()) { cmd.CommandText = ; //snip using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { //snip } } } } The while (reader.Read()) line is underlined. My question is when would the reader object ever be null? I've never come across it and the documentation doesn't mention that it

ReSharper Unit Test Runner: Support for Deployment Items

南笙酒味 提交于 2019-11-28 12:03:14
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. You have to select the unit test provider on the list, then the controls to do that appears.