1

I'm using Visual Studio 2010, project is in VB.NET, and I have ReSharper 7.1

It is falsely reporting errors not just warnings or suggestions.

lblAccountID.Text = AccountID.ToString()

ReSharper is giving me an error on the ToString, telling me "Incorrect number of arguments."

AccountID's Type is a custom class we have created, and it has ToString overloads that accept 0 parameters, or 1 parameter as DisplayFormat, or 1 parameter as another custom class we made that's another type of a displayformat. For some reason ReSharper is only seeing the 2 overloads that accept 1 parameter and it thinks the overload that accepts 0 parameters does not exist. I am calling ToString on this type of object in 13 different places so it is reporting 13 different errors but the code compiles and runs perfectly fine. There is no error, and it does not give me the option to ignore it.

Is there a way I can turn this off? I really don't need ReSharper telling me about these kinds of errors int he first place because if they truly exist Visual Studio will tell me about them itself.


Edit

I figured out how to recreate this issue, but it's an odd one. Just a bug in ReSharper, I guess. I reported it in their issue tracker.

This is the simplest way to recreate it. Inside of 1 project (ClassLibrary1):

Public Class Class1
  Public Overridable Overloads Function ToString(i As Integer) As String
    Return "Class1 - " & i.ToString()
  End Function

  Public Overloads Function ToString(s As String) As String
    Return "Class1 - " & s
  End Function
End Class

Public Class Class2
  Inherits Class1

  Public Overrides Function ToString(i As Integer) As String
    Return "Class2 - " & i.ToString()
  End Function

  Public Overloads Function ToString(f As Boolean) As String
    Return "Class2 - " & f.ToString()
  End Function
End Class

Then in a new project in a new solution (cannot recreate error when both projects are in the same solution), add a reference to the DLL created from the 1st project.

Dim o As New Class2
Dim s As String = o.ToString()
s = o.ToString(s)

Both of these ToString methods are defined in Class2's base class, or the base class's base class, and ReSharper can't seem to find them, thinks they don't exist, and marks it as compile error even though it builds and runs perfectly fine.

Nick
  • 4,556
  • 3
  • 29
  • 53

1 Answers1

0

From within Visual Studio, if you navigate to ReSharper->Options and then select Inspection Severity under Code Inspection you should be able to turn off the warning by selecting "Do not show" to the right of the item. See the screenshot below. Having said that, I wasn't able to locate the specific error mentioned in the question text, hopefully you will have better luck.

ReSharper Options

Malice
  • 3,927
  • 1
  • 36
  • 52