非淡泊无以明志,非宁静无以致远 -心静如止水,动于静

Ambiguous match found in web application

Today, we met a problem: everything is ok after I convert vs2003 to vs2008 except when execute a one page, the error is : Ambiguous match found. and runTime parser indicates this error occurs at <@ <%@ Page language="c#" Codebehind=....%>. Build process is ok, not any error occurs. After find help from internet, there is saying:

It seems like you have two variables in your page that differ only in the
case. For example, in your aspx page, you might have

<asp:TextBox ID="UserID" runat="server"/>

and in the code behind file you might have

private Int32 userID = 0;

Note that in my example, even though the variables have different
accessiblity and types, the variable names are similar (the difference is
only in the case).

In my opinion, this is a bug - C# is case sensitive and the above code is
perfectly legal from the point of view of the C# compiler. This explains why
it works as intended from within the VS 2005 IDE. The aspnet_compiler too
does not report any errors when you try to compile you website. However, some
error in the reflection mechanism causes a case insensitive search and that
is the reason for this "Ambiguous match found." error.

 

from the source code review, yes, it is, there is LinkButton1 and Linkbutton1 2 varibles declaration. after remove one, everyting is OK.


posted @ 2010-06-01 12:58  烟雨客  阅读(359)  评论(0编辑  收藏  举报