Jean Alexander Woldner
Jean Alexander Woldner

Reputation: 129

InitializeComponent() - Ambiguous invocation warning?

I admit that I'm new to the world of xaml but seeing warnings using the built-in Visual Studio templates indicate that there might be another issue besides my brain.

If I create an empty VSIX Project (it has to be a VSIX Project) in Visual Studio using Add -> New Project, and then proceed to create a new user control using Add -> New Item -> User Control (WPF), after I have compiled the code, the editor shows me the warning Ambiguous invocation on the line InitializeComponent(), as shown below:

ambiguous invocation


EDIT

There are warnings in the Designer view as well, shown below:

designer view


The warning is only present in the editor. Building the project is no problem, as shown below:

enter image description here


Please note that there are NO warnings if you add a User Control (WPF) to a Class Library (.NET Framework) project, as shown below:

enter image description here


If I look in the obj/Debug/ folder of SomeProject I see two files for SomeControl. The first is SomeControl.g.cs, and the second is SomeControl.g.i.cs. The files are identical.

The same goes for the obj/Debug/ folder of SomeOtherProject, without the warning.

I have cloned various official Microsoft repos (e.g. UnitTestBoilerplateGenerator) and the warning is present here as well, for example in: src/View/CreateUnitTestBoilerplateDialog.xaml.cs at InitializeComponent(), as shown below:

microsoft project


What's going on?? =(

EDIT

This is using Visual Studio 15.4 and ReSharper 2017.2.2; I don't seem to be getting this warning with older versions of Visual Studio/ReSharper.

EDIT

This seem to be a ReSharper specific problem, since after suspending ReSharper the warnings are no longer present. I have submitted a bug through ReSharper -> Help -> Report a Bug or Submit Feedback....

Upvotes: 4

Views: 1169

Answers (1)

Alexander Kurakin
Alexander Kurakin

Reputation: 13533

It is a known issue for ReSharper 2017.2.x

Update: It was fixed in ReSharper 2017.3 version.

Upvotes: 3

Related Questions