Resharper: Ambiguous Invocation

妖精的绣舞 提交于 2019-12-11 13:25:45

问题


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;
    }

回答1:


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.



来源:https://stackoverflow.com/questions/25146175/resharper-ambiguous-invocation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!