resharper

Business Case for ReSharper

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We are trying to get ReSharper introduced to our company but it would have to be for all developers. Management want us to justify the cost with a business case. I am unsure how to go about getting proof that ReSharper will benefit the business. What kind of statistics can you get from it? 回答1: I am unsure how to go about getting proof that Resharper will benefit the business. If they asked for a business case, they're not asking for proof, just some kind of fact-based estimate of the likely return on their investment. So, for example: A

Resharper - turn off solution wide analysis

…衆ロ難τιáo~ 提交于 2019-12-03 01:05:56
I want to turn it off completely and not get any solution-wide hints. I only see where I can pause I but can't find an answer for turning it off. In Resharper 5.1, turn it off by unchecking the 'Analyze errors in whole solution' under ReSharper->Options->Code Inspection->Settings You can also turn it off by right clicking on the green analysis circle (bottom right of Visual Studio) and select 'Analyse Errors in Solution'. In the tool window for Solution-wide analysis: the ⑪ button pauses, as you have found; the button to the left of that (the first button in that toolbar) turns off SWA . 来源:

Is there a way to auto-generate GetHashCode and Equals with ReSharper?

笑着哭i 提交于 2019-12-03 01:01:34
In eclipse, when I code in Java, there is a feature to auto-generate a basic, efficient, and bug free implementation of hashCode() and equals() without consuming brain power. Is there a similar feature either built-in in Visual Studio or in ReSharper ? svick Yes, Resharper can do that. With cursor inside your type, open the “Generate code” menu ( Alt + Ins depending on settings or Resharper -> Edit -> Generate Code ), and select “Equality members”: This opens a window where you can select which members are used for equality, along with some options about the generated code (e.g. should your

Resharper: Possible Multiple Enumeration of IEnumerable

為{幸葍}努か 提交于 2019-12-03 00:59:24
I'm using the new Resharper version 6. In several places in my code it has underlined some text and warned me that there may be a Possible multiple enumeration of IEnumerable . I understand what this means, and have taken the advice where appropriate, but in some cases I'm not sure it's actually a big deal. Like in the following code: var properties = Context.ObjectStateManager.GetObjectStateEntry(this).GetModifiedProperties(); if (properties.Contains("Property1") || properties.Contains("Property2") || properties.Contains("Property3")) { ... } It's underlining each mention of properties on the

Resharper (Find and) fix all issues at once

◇◆丶佛笑我妖孽 提交于 2019-12-03 00:55:10
e.g. alt enter -> context menu -> Find all 'Redundant name qualifier' issues -> but now in the new window that lists all those issues in my project, is there a way to fix them all ? (rather than go through them individualy) ta. For now, you have to go through the issues individually. There's an existing request to batch-apply fixes to all similar issues selected in the "Inspection Results" tool window. Code Cleanup does batch-remove certain issues in any given scope but it's quite limited in the number of fixes it can apply, compared to the number of code issues that ReSharper is able to

Why does ReSharper think that “thread.Name == null” is always false? [closed]

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a helper method for conveniently setting the Name of a Thread : public static bool TrySetName(this Thread thread, string name) { try { if (thread.Name == null) { thread.Name = name; return true; } return false; } catch (InvalidOperationException) { return false; } } It's working as intended. ReSharper, however, claims that the condition is always false and the corresponding code is heuristically unreachable. That's wrong. A Thread.Name is always null until a string is assigned. So, why does ReSharper think it is? And is there

CanBeNull and ReSharper - using it with async Tasks?

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I recently figured out that you can use the [CanBeNull] annotation in C# to tell ReSharper (and other addons) that a method can return null. This is great, because it makes ReSharper remind me when I don't handle those situations. However, for async methods that return a Task or a Task<T> , the behavior is unexpected. For instance, consider this example: [CanBeNull] public async Task<string> GetSomeName() { var time = DateTime.Now; if(time.Second == 30) { return "Jimmy"; } else { return null; } } I know that this scenario is a bit weird, but

最全的Resharper快捷键汇总

匿名 (未验证) 提交于 2019-12-02 23:42:01
编辑 Ctrl + Shift + Space代码完成 Ctrl + Alt + Space代码完成 Ctrl + P 显示参数信息 Alt + Insert 生成构造函数,属性,重载成员函数,实现接口 Ctrl + Alt + J 生成if,try..catch,#region块 Ctrl + / 注释及取消//注释 Ctrl + Shift + / 注释及取消/**/注释 Ctrl + W 增量选择块 Ctrl + Shift + W 增量反选 Alt + Enter 显示错误的修正方法 Ctrl + Alt + F 格式化代码 Ctrl + Alt + O 根据指示修改优化 Ctrl + D 复制当前行或选定的块 查找 Alt + F7 查找变量,方法的引用 Alt + Shift + F7 在设定范围中查找 Ctrl + Shift + F7 高亮显示 Ctrl + Alt + Up / Down 定位到下/前一个引用 Ctrl + Alt + F7 快速定位引用位置 Ctrl + Shift + F4 关闭查找结果tab Ctrl + Alt + U 定位到查找结果 导航 Ctrl + N 定位到类型 Ctrl + Shift + N根据文件名定位 Ctrl + E 最近文件列表 Ctrl + Shift +Backspace 上次编辑位置 Ctrl + B

Get Resharper to Consume StyleCop configuration

你。 提交于 2019-12-02 22:14:58
Our project already has a StyleCop configuration. I am using ReSharper and I would like to be able to have R# use the StyleCop settings. I know that you can use StyleCopForResharper to build the settings in Resharper and export them as a StyleCop configuration, but can you do the reverse and have Resharper consume the existing StyleCop config? I am not sure is this post still actual. There is free StyleCop for ReSharper at CodePlex. It uses StyleCop assembly so it will use project file settings. I don't know of any way to do this, but it is possible for R# to layout your members/properties

测试 ASP.NET Core API Controller

匿名 (未验证) 提交于 2019-12-02 22:10:10
本文需要您了解ASP.NET Core MVC/Web API, xUnit以及Moq相关知识. 这里有xUnit和Moq的介绍: https://www.cnblogs.com/cgzl/p/9178672.html#test Controllers可以说是ASP.NET Core MVC/Web API项目的核心, 它们把整个应用都整合到了一起. 可以说Controllers是非常重要的, 所以我们应该对它们做一些测试. 由于我几乎只做API, 所以本文不包括关于MVC功能的测试, 只包括Controller的API相关功能. 测试一个简单的Controller 先举一个简单点的例子: 这个Controller相对简单, 它有一个依赖项. 它一个方法, 返回类型是IActionResult, 又具体分为两种情况. 测试返回结果的类型 首先需要new出来一个被测试的RootController, 标准的叫法叫 System Under Test(被测试系统) . 它需要一个urlHelper作为依赖项, 那就 Mock 一个即可. 每组测试数据都会走一遍构造函数的 . 该测试方法使用的是 Theory , 用了4组数据. 执行方法后返回的结果类型应该实现了IActionResult接口, 这里可以用 Assert.IsAssignableFrom<TExpected>