resharper

Why does resharper suggest “wrap variable in array” for access to modified closure warnings?

余生颓废 提交于 2019-12-01 13:44:36
问题 Given the following (heavily edited, pseudo-)code: int count = 0; thing.Stub(m => m.AddBlah()).WhenCalled(o => count++); thing.Stub(m => m.RemoveBlah()).WhenCalled(o => count--); DoStuff(thing); Assert.AreEqual(1, count); ReSharper provides a warning on count - "Access to modified closure". I understand why I'm getting this warning (the count variable is being modified in two different lambdas, and is likely to have undesirable semantics), but I don't understand ReSharper's advice: "Wrap

Make ReSharper respect your preference for code order

自闭症网瘾萝莉.ら 提交于 2019-12-01 10:59:08
Related to my other question: What's the best way to layout a C# class? Is there a way in ReSharper to define the order you want your members to be in, so that ReSharper will maintain it? Michael Meadows From this answer : Check under Type Members Layout in Options (under the C# node). It's not simple, but it is possible to change the layout order. 来源: https://stackoverflow.com/questions/603805/make-resharper-respect-your-preference-for-code-order

How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?

落花浮王杯 提交于 2019-12-01 08:48:36
In every Visual Studio.NET version you can set keyboard shortcuts using menu Tools -> Options -> Environment -> Keyboard and then find the command you want to assign a shortcut to by entering part of it in "Show commands containing". For one thing, the listbox is ridiculously short and hard to navigate - is there an alternative? Then, how do I find out the correct command name for a specific action? Specifically, I'm using ReSharper 5.1 with Visual Studio 2010 and want to have the Alt + Enter shortcut back (it used to be there in older versions by default) that opens the ReSharper context menu

Jasmine and Requirejs in Resharper 7

蹲街弑〆低调 提交于 2019-12-01 06:39:42
I'm trying to run some JavaScript code using jasmine and Resharper 7 within visual studio 2012. I follow the AMD pattern with the aid of requirejs. However, i haven't managed to make my test run in the Resharper test runner. Has anyone managed to do anything similar to that? Use a named requireJS Module define("my/sut", function () { var MySut = function () { return { answer: 42 }; }; return MySut; }); And initialize the SUT with the asyncronus support of Jasmine. Don't forgot the references! /// <reference path="~/Scripts/require.js"/> /// <reference path="../code/sut.js" /> describe(

How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?

北慕城南 提交于 2019-12-01 06:24:03
问题 In every Visual Studio.NET version you can set keyboard shortcuts using menu Tools -> Options -> Environment -> Keyboard and then find the command you want to assign a shortcut to by entering part of it in "Show commands containing". For one thing, the listbox is ridiculously short and hard to navigate - is there an alternative? Then, how do I find out the correct command name for a specific action? Specifically, I'm using ReSharper 5.1 with Visual Studio 2010 and want to have the Alt + Enter

dotCover not showing all of the projects in a solution

て烟熏妆下的殇ゞ 提交于 2019-12-01 05:52:28
Let me start by saying I'm new to both ReSharper and dotCover and that I'm using v10.0.2 of both. The attached screenshot shows solution explorer in VS and the coverage tree for a set of tests. Whenever I run coverage, it always shows the same subset of assemblies in the coverage tree. Importantly, all of the tests shown are for code in either the Services or Infrastructure assemblies, neither of which show in the coverage tree. Clearly, the product is not doing something right or I'm not. Why are only some of the assemblies shown in the coverage tree? Why aren't any of the assemblies covered

Jasmine and Requirejs in Resharper 7

我们两清 提交于 2019-12-01 05:46:04
问题 I'm trying to run some JavaScript code using jasmine and Resharper 7 within visual studio 2012. I follow the AMD pattern with the aid of requirejs. However, i haven't managed to make my test run in the Resharper test runner. Has anyone managed to do anything similar to that? 回答1: Use a named requireJS Module define("my/sut", function () { var MySut = function () { return { answer: 42 }; }; return MySut; }); And initialize the SUT with the asyncronus support of Jasmine. Don't forgot the

Visual Studio 2012: List of all Methods in class

时间秒杀一切 提交于 2019-12-01 05:18:34
In VS 2010, is there a way to see all the Methods in a docked window for the currently viewed class. Clicking the method would let me navigate to it. This question is for design mode, while editing a class in the IDE. I own Resharper, but don't see a way to see all the methods in a nice list as a feature. View -> Class View or Ctrl + Shift + C You see the different classes on the top panel and the methods on the bottom panel. Also, you have the method list on the top part of your tab: If you have Resharper at your disposal as you indicate, you can use the File Structure window. It looks like

Is ToArray() optimized for arrays?

一曲冷凌霜 提交于 2019-12-01 05:04:11
ReSharper suggested to enumerate an IEnumerable<T> to a list or array since I had "possible multiple enumerations of IEnumerable<T> " . The automatic code re-factoring suggested has some optimization built in to see whether IEnumerable<T> already is an array before calling ToArray() . var list = source as T[] ?? source.ToArray(); Isn't this optimization already built-in the original LINQ method? If not, what would be the motivation not to do so? Nope, there is no such optimization. If source is ICollection , then it will be copied to new array. Here is code of Buffer<T> struct, which used by

Call is ambiguous error using Linq

狂风中的少年 提交于 2019-12-01 04:47:42
First of all, sorry for excesive generic name classes. My employer is paranoid and I know for sure he roams this site. Ok, so I have this code: var fooObj = new MyFooClass() { fooField1 = MyEnum.Value3, fooField2 = false, fooField3 = false, fooField4 = otherEntity.OneCollection.ElementAt(0) as MyBarClass } where otherEntity.OneCollection is an ISet. ISet is a NHibernate collection class that implements IEnumerable. If I try to compile this code I get this error: Error 2 The call is ambiguous between the following methods or properties: 'System.Linq.Enumerable.ElementAt<MyFirm.Blah.Blah