all groups > asp.net webcontrols > january 2004 >
You're in the

asp.net webcontrols

group:

"ambiguous match found" error



"ambiguous match found" error Anthony Ruggeri
1/30/2004 11:34:52 AM
asp.net webcontrols: I've heard a little bit about the "ambiguous match found" problem with
VB.Net custom controls. We suddenly started getting this error yesterday.
We are running ASP.NET 1.1 and using Visual Studio 2003.

Has anyone else seen this error and (better yet) a solution? I heard that
it was fixed in 1.1 but it obviously is not.

Re: "ambiguous match found" error Anthony Ruggeri
1/30/2004 3:11:30 PM
Unfortunately changing the name of the property is not really an option,
since the idea is that derived classes will expose the same interface as is
found in the base class.

Plus we are using VB.NET, not C#.

[quoted text, click to view]

Re: "ambiguous match found" error Christian Falch
1/30/2004 7:23:00 PM
Hi,

[quoted text, click to view]

I saw it yesterday, and fixed it yesterday as well.

The reason behind why I experienced the error message can be described
with the following scenario:

I've got two classes; MyBaseClass and MyDerivedBaseClass. Both has a
property called ParentBaseControl which is returns an instance of
MyBaseClass in MyBaseClass controls, and is overridden by the keyword
"new" in the class MyDerivedBaseClass:

public class MyBaseClass
{
public MyBaseClass ParentBaseControl...
}

public class MyDerivedBaseClass: MyBaseClass
{
public new MyDervivedBaseClass ParentBaseControl...
}

When using reflection to set the property ParentBaseControl, I get the
error message you described, since reflection can't decide which of the
two properties to use (which is correct, since both are accessible in
the derived class: the parent class' property can be set with
base.ParentBaseControl = value).

The solution was simply to give the property a different name in the
derived class.

Hope this helps!

--
Re: "ambiguous match found" error Christian Falch
1/30/2004 10:33:32 PM
Hi,

[quoted text, click to view]

So, was my suggestion the cause of the error?

[quoted text, click to view]

Yes, but since they're using the same backend, the concept is really
just the same.

--
AddThis Social Bookmark Button