The call is ambiguous between the following methods: Identical.NameSpace.InitializeComponent() and Identical.NameSpace.InitializeComponent()

前端 未结 12 1592
野趣味
野趣味 2021-01-17 12:09

Ok, I suspect this might be a Visual Studio thing, but there must be some reason for this. I created from the list of default items a ListBox (Right Click on project, or fol

相关标签:
12条回答
  • 2021-01-17 12:10

    I ran into this issue, with a user control and an associated style. I think I had tried to move some logic into the style class but it didn't work, so I undid it, but apparently something got left behind.

    It was also complaining about the _contentLoaded variable, so I tried deleting the one that was there, and the error went away, and was not replaced with another error. I then hit F12 to go to _contentLoaded's definition and found that it was in the *.g file for the style class. Though the file was named after the style, the class inside was named after the user control.

    I deleted the bin and obj folders to resolve it.

    0 讨论(0)
  • 2021-01-17 12:17

    It appears that you have declared the InitializeComponent method in two places in your class, probably one in each partial class. Try searching in all files for InitializeComponent in Visual Studio and I'm guessing that the results will list two places where it is declared. Delete one and the error will disappear.


    UPDATE >>>

    I'm not sure what kind of answer you're expecting here... clearly, if you didn't add one of those InitializeComponent method definitions, then visual Studio has a bug. I very much doubt that there can be any kind of logical reason for this except that it's a bug.

    UPDATE 2 >>>

    I had a look on the Microsoft Connect website for any existing reported bugs like this but couldn't find any... I've left the link here if you do want to report it to them.

    0 讨论(0)
  • 2021-01-17 12:18

    I had this issue when copying my XAML between controls. I just had to change my x:Class="mynamespace" where mynamespace is the proper namespace for your project. Recompiled and all went back to normal.

    0 讨论(0)
  • 2021-01-17 12:19

    After copy and paste, as well as renaming the new class in code, also open the designer and change the name in the first line of the XAML. Build the project. Fixed!

    0 讨论(0)
  • 2021-01-17 12:20

    I fixed this issue by cleaning up the bin and obj folders. You can try to remove these two folders and then rebuild the solution.

    0 讨论(0)
  • 2021-01-17 12:23

    I managed to resolve this by looking inside the .csproj file with a text editor and looking for the name of the Table Adapter XSD file. I found two references to it one with a different alias name hence why I was getting this error message.

    0 讨论(0)
提交回复
热议问题