1

Using Resharper I get the following message:

Ambiguous InvocationSolution ITicket.sln Project ITicket ITicket\frmMainTicket.cs:530 Ambiguous invocation: void DisableAllFields() (in class frmMainTicket) void DisableAllFields() (in class frmMainTicket) match

I am new to coding and could use a little help. If I understand this correctly it is basically saying that I am calling a method and it is unsure what method I should use? I have never used Resharper before. Maybe I am confused on what Ambiguous Invocation is, I have done some research on it though. Thank you in advance.

From the code:

        private void SetViewForBugnetTicket()
    {
        DisableAllFields();

        btnSendBugnetDev.Enabled = false;
    }

Method:

        private void DisableAllFields()
    {
        tbSubject.Enabled = false;
        cmbCreatedBy.Enabled = false;
        cmbDepartment.Enabled = false;
        cmbCompany.Enabled = false;
        dtpCreatedOn.Enabled = false;
        dtpAssignedOn.Enabled = false;
        dtpDueDate.Enabled = false;
        cmbAssignedBy.Enabled = false;
        cmbMainTech.Enabled = false;
        cmbStatus.Enabled = false;
        cmbPriority.Enabled = false;
        cmbCategory.Enabled = false;
        cmbTicketType.Enabled = false;
        radBtnNoTraining.Enabled = false;
        radBtnYesTraining.Enabled = false;
        btnAddNoteDev.Enabled = false;
        tbNoteAdd.Enabled = false;
        rtbDescription.Enabled = false;
        tsBtnSaveTicket.Enabled = false;
        btnSetStatus.Enabled = false;
        btnResolve.Enabled = false;
        tbResolution.Enabled = false;
        cmbResolution.Enabled = false;
        btnBrowse.Enabled = false;
    }
Anthony
  • 193
  • 1
  • 13
  • It's saying that you have 2 methods with the same name in 2 different classes "void DisableAllFields() (in class frmMainTicket) void DisableAllFields() (in class frmMainTicket) match". There is a method called DisableAllFields in frmMainTicket and in frmMainTicket. I'm confused why it's saying this though because both of those classes have the same name – reggaeguitar Aug 05 '14 at 18:54
  • Could this happen if there were two `frmMainTicket` classes in different namespaces? – Philip Pittle Aug 05 '14 at 18:57
  • 2
    And is Resharper saying this or are you getting compiler errors? Resharper tries to preemptively show warnings / errors, but this doesn't always match up with the compiler. At the end of the day it's only the compiler errors that matter, in so far as generating an exe / dll. – Philip Pittle Aug 05 '14 at 18:58
  • No compiler errors at all, program works fine. – Anthony Aug 05 '14 at 19:48

1 Answers1

0

We had this problem. It occurred in R# 9.2 VS2013 and VS2015 w/ VB.net. We had local variables in a method declared as

Dim Yield as Decimal

Later, an assignment was made.

Yield = CDbl(txtFoo.Text)

The fix is to qualify the token which is a reserved keyword with the characters [ and ]

Dim [Yield] as Decimal
[Yield] = CDbl(txtFoo.Text)

Aside: Yes. It was actually CDbl. The confusion between Double and Decimal abounds in this codebase. It probably needs to go on daily WTF.

JJS
  • 6,431
  • 1
  • 54
  • 70