I got a weird warning that I don't understand.
I have two UserControls. The first one BaseControl inherits from Button and the second SecondControl inherits from BaseControl.
I didn't change anything so both UserControls are like VS2012 creates them (default constructor etc.) I only removed the sealed keyword of BaseControl in order to inherit it.
Now if I build the project the following warning is put out:
'MyProject.Controls.SecondControl.Connect(int, object)' hides inherited member
'MyProject.Controls.BaseControl.Connect(int, object).' Use the new keyword if hiding was intended.
When I click on this warning, VS2012 opens a file named 'SecondControl.g.cs' and shows this:
partial class SecondControl: global::MyProject.Controls.BaseControl, global::Windows.UI.Xaml.Markup.IComponentConnector
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void Connect(int connectionId, object target)
{
this._contentLoaded = true;
}
}
What does this mean? I don't have any method called Connect() except for this in SecondControl.g.cs but that is none of my methods.
Any hint how to fix this? Even it is only a warning and my application works fine, I don't like to have any warnings/errors in the output window :)
I found some articles about this error on SO but none of these helped me :(
Edit: Adding the whole classes mentioned above.
BaseControl:
namespace MyProject.Controls
{
public partial class BaseControl : Button
{
public BaseControl()
{
this.InitializeComponent();
}
}
}
SecondControl:
namespace MyProject.Controls
{
public sealed partial class SecondControl: BaseControl
{
public SecondControl()
{
this.InitializeComponent();
}
}
}
I checked the whole inheritance chain of Windows.UI.Xaml.Controls.Button and there is no Connect(int, object) or any other Connect(). I didn't add any Connect()-method too.