resharper

Why does resharper say 'Catch clause with single 'throw' statement is redundant'?

半世苍凉 提交于 2019-11-28 02:33:14
问题 I thought throwing an exception is good practice to let it bubble back up to the UI or somewhere where you log the exception and notify the user about it. Why does resharper say it is redundant? try { File.Open("FileNotFound.txt", FileMode.Open); } catch { throw; } 回答1: Because try { File.Open("FileNotFound.txt", FileMode.Open); } catch { throw; } is no different than File.Open("FileNotFound.txt", FileMode.Open); If the call to File.Open(string, FileMode) fails, then in either sample the

Use “convert to auto property” on multiple properties at once

守給你的承諾、 提交于 2019-11-28 01:17:18
问题 I find myself using Resharper's "convert to auto property" refactoring a lot to remove pre C# 3.0 boilerplate code. Is there a way I can apply this to all properties in a single class at once? 回答1: The ReSharper can do this: Options -> Code Cleanup -> Use auto-property, if possible Run code cleanup for the class - and you should be done. 回答2: Tanascius has the right answer, though you can tweak that a little bit by creating your own custom Code Cleanup script that would ONLY include the "Use

State of Jasmine Unit Test support of Resharper 2017: Debug mode and AMD modules supported?

不打扰是莪最后的温柔 提交于 2019-11-28 01:16:05
问题 I currently use Chutzpah to run and debug Jasmine Unit tests that include AMD/require.js modules. I would like switch to the test runner of Resharper 2017. However, Resharper does not seem to fully support Jasmine Unit Tests? A. Example jasmine test: /// <reference path="../../bower_components/requirejs/require.js" /> /// <reference path="../../bower_components/jasmine-core/lib/jasmine-core/jasmine.js" /> describe('dummy example test', function() { it("should return bar", function () { expect

Visual Studio 2015 Enterprise with ReSharper 10 Ultimate — Cannot be properly resolved

半城伤御伤魂 提交于 2019-11-28 00:40:01
I have Visual Studio 2015 Enterprise, version 14.0.24720.00 Update 1 as well as ReSharper 10 Ultimate, version 10.0.2 installed. I have a typescript file that is using AtScript syntax to refer to the Angular2 directive module, as its annotation. However, ReSharper is stating the following error: Symbol 'Directive' cannot be properly resolved, probably it is located in inaccessible module. Below is the full error tooltip. The application compiles and runs as expected, and the angular portions of the application also function as desired. It appears as though this is a ReSharper false negative.

Coloring instance variables in Visual Studio

点点圈 提交于 2019-11-27 23:14:58
问题 Is it possible to color instance (and static) variables in C# code in Visual Studio 2010, perhaps using a lightweight extension? In following example name and age should be colored but test not. Of course, usages of variable highlighting is grat feature but this is something different. I want instance variables to be colored all and always. Many people use _underscores to distinguish instance variables but I prefer to use coloring. public class Kid { private string name; private int age;

C# 'var' keyword versus explicitly defined variables [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-11-27 20:26:24
This question already has an answer here: Use of var keyword in C# 86 answers I'm currently using ReSharper's 30-day trial, and so far I've been impressed with the suggestions it makes. One suggestion puzzles me, however. When I explicitly define a variable, such as: List<String> lstString = new List<String>(); ReSharped adds a little squiggly green line and tells me to: Use implicitly type local variable declaration. If I then follow its suggestion, ReSharper changes the line of code to: var lstString = new List<String>(); So, is there some sort of performance gain to be had from changing the

ReSharper color identifiers screw up with Visual Studio 2012 dark theme

懵懂的女人 提交于 2019-11-27 19:55:49
问题 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,

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

感情迁移 提交于 2019-11-27 19:49:23
问题 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? 回答1: 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

Shortcut to instantiate an object in Visual Studio

梦想与她 提交于 2019-11-27 19:23:50
问题 I have a class with more than 8 properties, and I often want to instantiate it in some method, but it is super tedious to have to write the properties one by one to assign them the value. Is there any way to insert a kind of "code fragment" with a keyboard shortcut, which allows me to insert the instance of the class, and I just modify the values ​​to add?. I do not want to use constructors because I want the instance to be readable for the reader of my code and because the constructors do

Resharper Navigate to MVC View

僤鯓⒐⒋嵵緔 提交于 2019-11-27 18:31:48
I recently upgraded to Resharper 8.1 and VS 2013 Before I could ctrl+click on a View to jump to it, but this no longer works. Is there a feature I need to enable to get it back? PartialView("_MainMenu", viewModel); Samuel Jack Go to Resharper->Manage Extensions and click the Online tab. Then search for Resharper.ExternalAnnotations, and install the package it comes up with. Finally go to Visual Studio Tools->Options and go to the Resharper->General options page. Click Suspend Now followed by Resume to restart Resharper. About workaround for previous versions of ReSharper: You can download