resharper

Am I implementing this simple contract incorrectly?

假装没事ソ 提交于 2020-01-22 10:40:21
问题 This is my code: public class RegularPolygon { public int VertexCount; public double SideLength; public RegularPolygon(int vertexCount, double sideLength) { Contract.Requires(vertexCount >= 3); VertexCount = vertexCount; SideLength = sideLength; } [ContractInvariantMethod] private void RegularPolygonInvariants() { Contract.Invariant(VertexCount>=3); } } I have tried with both the Contract.Requires and Contract.Invariant methods to prevent the vertexCount variable from becoming less than or

Resharper Unit Tests not running

核能气质少年 提交于 2020-01-22 08:33:07
问题 I'm trying to get started writing unit tests in a project. I wrote the createTest first and tried it. This test passed and I started writing my other tests. Now all my tests just say "Test not run". This happens both when I try to run all tests at once and when I run a single test. https://github.com/Requinard/OperationOctopus/tree/UnitTest All I've found so far is people using NUnit. We're using the default microsoft testing framework, with resharper running the tests. [TestMethod] public

Why C#8 Default implementations of interface members will report an error

前提是你 提交于 2020-01-15 12:36:07
问题 Why C#8 Default implementations of interface members will report an error? public interface Logger { void Info(string message); void Error(string message); // C#8 Default implementations of interface void Warn(string message) { // "interface method cannot declare a body" error message } } and .NET Core 3.0 is configured as shown in the screenshot. 回答1: This is a Resharper/Rider bug: https://youtrack.jetbrains.com/issue/RSRP-474628 回答2: The feature is sound and your setup is correct. Also the

Why does R# tell me, “Not all code paths return a value” in a click handler?

試著忘記壹切 提交于 2020-01-15 05:14:47
问题 At the end of my submit button click handler, Resharper warns that, "Not all code paths return a value." What value would it be expecting from an event handler? In deference to full disclosure, this is that event handler: $("#submit_button").click(function() { // http://stackoverflow.com/questions/18192288/how-can-i-compare-date-time-values-using-the-jqueryui-datepicker-and-html5-time var begD = $.datepicker.parseDate('mm/dd/yy', $('#BeginDate').val()); var endD = $.datepicker.parseDate('mm

Visual Studio: How to have explicit type by default

99封情书 提交于 2020-01-14 18:52:09
问题 We have Visual studio(2013) and resharper(V9), and currently by default, when create a new variable, we always have the first proposal as var . We are kind of allergic of this var (this is our opinion,I can accept that other doesn't have the same, but that's not the point). We can select with the keyboard arrows the explicit type, but we would like have it by default. I'm not sure if that default comes from Resharper or from Visual Studio, but does anyone has an idea how to have the explicit

Resharper: how to force introducing new private fields at the bottom of the class?

扶醉桌前 提交于 2020-01-14 13:49:07
问题 Resharper offers a very useful introduce and initialize field xxx action when you specify a new parameter in a constructor like: Constructor (int parameter) The only (minor) nuisance is that it puts the new field at the beginning of the class - and I'm a fan of putting private parts as far away as possible from the prying eyes of strangers ;). If, however, you already have some private fields in the class, Resharper will put the new field "correctly" (note the quotes, I don't want to start a

How to change shortcut keys for a given command in ReSharper?

独自空忆成欢 提交于 2020-01-14 08:52:29
问题 I need to change shortcut for finding member ( ALT + \ ) in ReSharper because of my native keyboard which brings me problem to press wrong key each time. Where can I re-set a new key combination for shortcuts in ReSharper? 回答1: Use Visual Studio's Keyboard options pane to change keyboard shortcut bindings. This can be found in Visual Studio by going Tools > Options > Environment > Keyboard . 来源: https://stackoverflow.com/questions/1657579/how-to-change-shortcut-keys-for-a-given-command-in

How do I specify that a Func object doesn't return null with JetBrains annotations?

坚强是说给别人听的谎言 提交于 2020-01-13 16:18:36
问题 I have a bit of code: public void Foo([NotNull] Func<string> bar) { //whatever } My problem is, the [NotNull] annotation is specifying that bar itself is not null. I'm looking instead for an annotation that says that the thing RETURNED BY BAR is not null. I expected that this was possible but it doesn't seem to be. They support ItemNotNull for IEnumerables so I don't see why we can't have ReturnsNotNull for Func objects. Am I just missing something obvious here? Surely something this basic is

How do I specify that a Func object doesn't return null with JetBrains annotations?

自闭症网瘾萝莉.ら 提交于 2020-01-13 16:15:06
问题 I have a bit of code: public void Foo([NotNull] Func<string> bar) { //whatever } My problem is, the [NotNull] annotation is specifying that bar itself is not null. I'm looking instead for an annotation that says that the thing RETURNED BY BAR is not null. I expected that this was possible but it doesn't seem to be. They support ItemNotNull for IEnumerables so I don't see why we can't have ReturnsNotNull for Func objects. Am I just missing something obvious here? Surely something this basic is

T4MVC and Resharper Navigation

天涯浪子 提交于 2020-01-13 10:55:11
问题 I frequently use Resharper's 'Go to Declaration' (ctrl + b in the Resharper Default Keymapping) keyboard shortcut to help with navigation within VS2010. Before I included a reference to T4MVC in my application, I would use "string refrences" and Resharper would know where I 'meant' to go. For example: @Html.Partial("_Continents" ) When I would use ctrl+b on the string "_Continents" , Resharper knew I wanted to go to the partial view named _Continents.cshtml. Since I have started using T4MVC,