I have Resharper and it's a fantastic tool
Starting a projects and I need to use CodeContracts. However Resharper ignores them.
After checking a few blogs I came across this one:
http://www.infinitec.de/post/2010/11/18/Using-Code-Contracts-Visual-Studio-and-with-Resharper.aspx
However I get an error
Error 2
The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite"
"#MyProject.Coreccrewrite.rsp"" exited with code 1.
Has anybody managed to have codecontracts and resharper to work together?
Edited
What I am doing is
Trying to use codeContract and resharper gives a Method invocation is skipped etc..
Googled and found lots of people with same problem and no solution.
As you can see I attached a link that should have done the trick but didnt
Create a new project in vs2012 and try to use code contract and resharper will not let you.
It will be disabled and if you enable it you get another error
Comment from Resharper team on
http://youtrack.jetbrains.com/issue/RSRP-182553#comment=27-200330
ReSharper will not support "Code Contracts" as is in the mid-term
future. There are 2 main reasons for this:
CodeContracts are written in the code block, and, moreover, in the separate assembly. ReSharper requires contracts to be at the
metadata level
Current contract are too complex and are not supposed to be analyzed in real-time.
During ReSharper development, we analyze CodeContracts and building
corresponding ReSharper code annotation marks. We are going to extent
our annotations, and always keep them in-sync with contracts.
I am stuffed!!!
Related
Resharper alerts me about public functions that are never accessed. This is useful in most areas in my code, but I have a project that contains classes that function as a public API (actually Hot-Chocolate GraphAPI functions), so, naturally, there are no calls to them elsewhere in the code. I don't need Resharper to tell me about them.
I know it's possible to disable these kinds of warnings per file by including a comment. I'm wondering if there is a way to disable this warning across an entire project.
N.B. I don't want to disable Resharper itself in this project (as described in this answer). Resharper is still providing value to me and it's just this specific warning that I want to disable.
ReSharper's help lists various ways to disable a specific inspection. You can disable a specific inspection in a scope either using an .editorconfig file, or with a ReSharper settings file.
Following the link provided (thanks #IgorAkhmetov) I created an .editorSettings file in the scope I wanted (the root of the single project) with the following contents:
resharper_unused_member_global_highlighting = none
resharper_class_never_instantiated_global_highlighting = none
Outcome: Resharper stopped telling me about unused public members, or uninstantiated public classes, in that project only. It carries on telling me about those problems in the rest of my codebase.
Option "Solution-wide inspections" can be turned off in project's properties:
Long story short, Android Studio's new Refactor feature to Migrate to Android X is buggy. In the end, I ended up with dozens of invalid, incomplete, non-existent component classes in my XML files and the compiler didn't complain. Only when testing at runtime did I realize what it's done.
Is there a lint option to find invalid class names / component types so that it flags something like this (which does not exist):
<androidx.widget.AppCompatSeekBar>....</androidx.widget.AppCompatSeekBar>
The actual class name is androidx.appcompat.widget.AppCompatSeekBar. I've had to do a lot of manual find and replace, but I feel reluctant posting this as an update and break an app that was working perfectly before.
I'm getting 110 warnings in my build after installing Azure SDK 2.3 that I don't recall seeing before. They are all for the file "Microsoft.WindowsAzure.targets".
An example of one such warning is:
The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'CloudToolsVersion'.
Has anyone else encountered this problem or know the right way to fix it?
Well, it looks like I just needed to close any open editors for msbuild project files to get those to disappear. Other answers I found suggested on the web were to disable schema validation or to extend the schema myself.
Very scary! From your solution and hints from other similar questions, I think I know what's going on: When any build script file (such as a .props) is open in a text editor, it turns on /validate. This is used to see red wavies in the editor and gives the warnings when the project is loaded by any MSBuild task. The schema holds the various element used by the MS targets infrastructure, and doesn't know anything else. I'm not sure what good that is, but there you have it.
I'm using xUnit for unit testing and in one of my test classes I have 65 tests. Resharper is flagging one of them as not used and is keeping the file flagged yellow/orange until I delete it. I don't want to delete it. I want to keep that test method.
I assume that you have xunitcontrib for ReSharper installed, since other test methods are not marked as unused. I also assume that your method is public and has the same test attributes as other test methods (e.g., Fact or Theory). If that is not the case, you might check that you have external annotations for attributes of this method (they are provided with xunitcontrib for ReSharper).
One of possible reasons for incorrect issue reporting by ReSharper is that some of its caches have not been updated. If you can reproduce the problem (given that almost a month passed since you asked your question, it seems to be unlikely), try clearing caches via menu RESHARPER -> Options -> General -> Clear Caches and then restart Visual Studio.
It could also be that the ReSharper annotations are turned off.
You could verify this via RESHARPER > Options > Code Inspection - Code Annotations.
I have ILMerged some assemblies. For example:
Foo.Bar
Bar.Foo
Foo.Baz
Into one assembly. For example:
FooBarBaz.Merged
And it works. That is, when I reference FooBarBaz.Merged and use something like Foo.Bar.MyClass in code it compiles just fine.
However Resharper (v5) does not work. Usages of any type from the merged assembly are bloody red. What's worse, I get no intellisense for these types either. Basically this assembly cannot coexist with Resharper.
I wonder if there's some ILMerge param that can cure this. ILMerge documentation is pretty well hidden, but I found this. I have hacked at various switches...to no avail.
Alternately, is there some Resharper setting I can change. I really prefer not to have to do this because this is an OSS project.
I have solved this. It's a bug in Resharper, I beleive. However it's not a bug that matters to me.
It seems that Resharper has trouble seeing types of an ILMerged assembly if the project that references that assembly is inside a solution that contains some of the assemblies that got merged. This is not a case that I care about.
I learned this from this thread.
For anyone who wants this fixed please go here to vote up support for ILMerged assemblies in R#: http://youtrack.jetbrains.com/issue/RSRP-192616