Main Site Documentation

ReSharper


#1

FYI… http://youtrack.jetbrains.com/issue/RSRP-386091

For porting kit users this might also be of interest:


#2

Speaking personally I’d steer clear of ReSharper, It is buggy and given that the tool modifies your source code (if you ask it to) it is a major risk to allow anything other than a rock solid tool to modify source.

For example it misunderstand the use of unsafe pointers in C# and flags clean valid C# as an error, it has no idea about the ‘fixed’ keyword and what it means.

Waste of time - IMHO.

B


#3

@ Barraty - Maybe an idea to inform jetbrains so that they can improve their product.

I am using it for more than two years and it had never effected my code in a negative way. But i guess its always up to the user to, or not to accept any code change proposal


#4

For C#, ReSharper is the second most productive tool after Visual Studio itself.


#5

couldn’t agree more…


#6

I did, I submitted it as a bug but was told to just disable the reporting of this specific error.

Would you trust a compiler if it reported syntax errors where there were none? I wouldn’t,
I’d expect the vendor to regard this as an urgent high priority bug not as a minor inconvenience.

Regarding code change, why should I change legal C# source code that compiles with no errors or warnings, complies fully with the rules of the language and executes exactly as required?

The tool does not understand the C# semantics with respect to the use of unsafe pointers and the taking of the address of a value type member, the Microsoft C# compiler does understand this which is why it reports no errors or warnings for this code.

Understand Reshaper wasn’t suggesting an improvement or alternative logic, it was objecting to the code as being in error, it was reporting a semantic error where there is none.

B


#7

Here’s a similar bug in the tool

It’s inexcusable to report source code as being invalid when it isn’t, by all means suggest a better way of coding something, I’m all in favor of that, but these issues are not that, the tool is claiming that the user’s source code is invalid but it isn’t and I cannot place my trust in such a tool or vendor when such a glaring bug is treated with indifference.

B


#8

Agreed. The first thing I always do after installing VS is install Resharper. That being said, there are certain “improvements” that it sometimes suggests that I have learned to ignore or disable. Resharper has taught me a lot over the years and I think it has helped me be a better programmer. That’s primarily because I always doubt its suggestions by default and take the time to understand them. They may not always be the best suggestion for the type of software you are trying to write. I’d never recommend anyone blindly accept refactoring from any tool.


#9

I’ve never formally compared the two but qualitatively how does ReSharper compare to the Visual Studio code analysis tools (that appeared initially in VS 2010 I think).

I do use that when authoring new code and it does help spot helpful things that can raise code quality but I’m unsure of ReSharper does the same or strives to do more.

B


#10

Resharper does much more. If you like what comes with VS then you will love Resharper.


#11

I think ReSharper is good tool, especially for people who just started to learn c# and .Net. Personally I don’t use it, though. I like my Visual Studio tight and lean. :slight_smile:


#12

Well, every software has its own bugs, so ReSharper is no exception. Bugs are part of the software, it has always been so and it will always be.

C# is not about the fixed pointers. I may sound a bit strict, but I’m sure unmanaged pointers are somewhere in the outskirts of the whole .NET, and for most C# programmers they are non-existent. So if you work with pointers a lot, and ReSharper doesn’t work well, then, kchem, you just don’t use it. There are many people, including me, who think ReSharper saved hundreds of ours of hard work, so telling that ReSharper is “waste of time” sounds, so to say, rough :slight_smile:


#13

This is a simple sample that will expose the ReSharper bug:

 
        
        // This code elicits errors from JetBrains ReSharper tool
       
        public struct AStruct
        {
            public long a_field;
            public double another_field;
            public byte   and_another_field;
        }

        public class AClass
        {
            private AStruct a_struct;

            public unsafe byte GetSecondByteOfDouble()
            {
                fixed (double * double_ptr = &(a_struct.another_field))
                {
                    byte * byte_ptr = (byte *)(double_ptr);
                    byte_ptr++;
                    return (*byte_ptr);

                }
            }
        }


This is just a contrived sample simply to show the error, although there may be some weird situations where one might really want the 2nd byte of a double - I doubt it though!

I’ve since removed ReSharper so can’t confirm if this is the actual scenario but I think it is, also be sure to enable “Allow unsafe code” in the VS project’s settings.

B

(PS: I hope my use of code tags is correct…)


#14

Maybe I’m missing something. With the code sample above, resharper complsined initially as I had not enabled the “Allow unsafe code” property. When I enabled unsafe code resharper was fine, no errors.

Personally I find resharper to be very beneficial. It is how I learnt Linq!


#15

@ NickP - totally agree! Always impressed how it shortens my LINQ expressions :smiley:


#16

Well I have since uninstalled it and can’t recall the exact code fragment that upset it - if I find it (perhaps in an e-mail I sent to JB then I’ll post it for you).

B


#17

ReSharper is absolutely fantastic tool, coding without it makes me feel one-handed :wink: