resharper

ReSharper - How to show custom snippet in IntelliSense

荒凉一梦 提交于 2019-12-10 13:55:25
问题 I've created a custom snippet that contains a shortcut proplto . If I hit Ctrl-K, Ctrl-X and open My Code Snippets I can select my snippet. I can also type proplto in code, hit TAB and the snippet is inserted. However, I can't find a way to display my snippet in IntelliSense. It shows prop and propg but not my proplto . I tried adding my snippet by going to Resharper > Templates Explorer , selecting C# and importing my snippet file. It says "No templates of type 'Live Templates' found in the

Resharper and Test categories

匆匆过客 提交于 2019-12-10 13:45:04
问题 In TestDriven.Net I can set the following from the TestDriven.Net Options Pane Run tests in all categories Exclude tests in categories Include tests in categories and they will be set once where I can add a comma seperated list. See http://weblogs.asp.net/nunitaddin/archive/2008/12/03/testdriven-net-options-pane.aspx Can this be done in resharper where I only have to do this once and it applies accross all sessions even when I close a session down? 回答1: It doesn't look like there's a way to

How can you configure ReSharper to make a build fail if code convention rules are violated?

ⅰ亾dé卋堺 提交于 2019-12-10 13:35:32
问题 Using VS2015 update 2, ReSharper 2016.1, is there a way to configure ReSharper to make a build fail if code convention rules are violated? 来源: https://stackoverflow.com/questions/37609902/how-can-you-configure-resharper-to-make-a-build-fail-if-code-convention-rules-ar

Does this Resharper fix for disposed closure warning make any sense?

好久不见. 提交于 2019-12-10 13:32:56
问题 I'm working on getting rid of some warnings from a static code analysis. In one specific case there was no disposing being done on a ManualResetEvent . The code in question executes a Func on the main thread and blocks the calling thread for a certain number of milliseconds. I realize this sounds like a weird thing to do, but it's outside the scope of this question, so bear with me. Suppose I add a using statement like so: object result = null; using (var completedEvent = new ManualResetEvent

follow up on R# warning: Possible 'System.InvalidOperationException'

五迷三道 提交于 2019-12-10 13:13:04
问题 I have the following expression, where a.AnswerId is of type long? . ReSharper warns of a possible InvalidOperationException in the select function. Is there ever a case where this could actually happen? (corner-cases are fine too) long[] ids = answers.Where(a => a.AnswerId.HasValue) .Select(a => a.AnswerId.Value) .ToArray(); 回答1: Since you check in the Where that a.AnswerId has a value, a.AnswerId.Value will never throw an InvalidOperationException (unless another thread is changing the data

Resharper - How to turn off 'private' access modifier?

独自空忆成欢 提交于 2019-12-10 12:59:25
问题 I don't like having 'private' placed before my access modifiers. They're all private by default anyways and it's just visual clutter. How do I turn off resharper constantly tagging everything with 'private'? 回答1: ReSharper 9.1 ReSharper -> Options -> Code Editing -> C# -> Code Style -> Modifiers -> Use explicit private modifier (Un-Check) **ReSharper 2016.1 ReSharper -> Options -> Code Editing -> C# -> Code Style -> Modifiers -> 回答2: In the ReSharper Options menu, go to Code Editing -> C# ->

Tab behavior Resharper Intellisense Options

邮差的信 提交于 2019-12-10 12:59:10
问题 A product like Resharper has many settings, and I can't seem to find the right settings to get the exact behavior I desire from it. The behavior I am trying to change is this: Suppose the endresult I want is but the line currently is As you expect I start typing: and after a tab I get this but I wanted it to become Does anyone know how I can change the Resharper settings in such a manner that my desired behavior is realized? Thank you. EDIT: Note that tab does perform the desired behavior in

Unit Tests are failing on a “Build failed” in the Session window with no message providing a reason for failure in Visual Studios 2010

元气小坏坏 提交于 2019-12-10 12:35:13
问题 I had recently installed VS 2010 on my local machine, and cannot seem to get Resharper 5.1 and the unit tests to work correctly. Whenever I try and run Unit tests I get a "Build failed" with the test icon remaining gray, but with no info in the output window and no discernible reason why. The Unit Tests run perfectly fine when doing a nant build. Running a previous branch of the code on VS 2008 does not have this same issue as a result. Any ideas? 回答1: Check your build configuration. If you

Warning in Resharper “Return value of pure method is not used”

情到浓时终转凉″ 提交于 2019-12-10 12:33:23
问题 I have a quick question regarding a warning that I am getting from Resharper in Visual studio on a c# project that I am working. The warning is: " Return Value of pure method is not used" The method where this is happening is as below: private static bool FilePathHasInvalidChars(string userInputPath) { try { //this is where the warning occurs: Path.GetFullPath(userInputPath); } catch (Exception e) { Log.Error(String.Format( "The Program failed to run due to invalid characters or empty " +

CanBeNull and ReSharper - using it with async Tasks?

我是研究僧i 提交于 2019-12-10 12:28:48
问题 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;