I've been dealing with this error message for the last couple of days, on a project that is being converted from ASP.NET 1.1 to ASP.NET 2.0. Various pages throughout the site are throwing a strange error:
ASP.NET Runtime Error: Ambiguous Match Found
After having done some research on this, I finally found an official explanation of why it happens on the ASP.NET Runtime Breaking Changes page at MSDN.
| Short Description |
Fields differing by case now throw an ambiguous reference exception |
| Affected APIs |
System.Web |
Severity |
Medium |
Compat Switch Available |
No |
|
| Description |
Due to the approved CLR breaking change for handling fields whose names differ only by case, we now throw an ambiguous reference exception. |
|
| User Scenario |
User who had fields in their code that differed only in casing now get compilation errors.
In v1, the CLR would arbitrarily match the first instance of the field it encountered when the name differed only by case. In version 2.0, it is now treated as an ambiguity. |
|
| Work Around |
Rename the duplicated fields. |
Basically what this says is "We weren't really sure how to handle case sensetive fields / names in the CLR, so we decided not to." Seems like a bit of an easy way out, rather than actually fixing the problem. Oh well, at least now I know why the error is being thrown and I should be able to fix my code. I just need to find any duplicated names that differ by case.
Update:
The issue in my application turned out not to be this. The problem stemmed from the upgrade process and the web deployment project that I added, which left my original compiled assemblies from the ASP.NET 1.1 project in the bin folder, but created new compiled assemblies for ASP.NET 2.0. The ASP.NET runtime system was throwing this exception because there were two assemblies with the same namespace/classname in the bin folder.
Be sure to clean out your bin\ folder when upgrading projects. It will save a lot of time and effort.