Total Frustration: Ambiguous Match Exception with WebForms

time to read 1 min | 168 words

A colleague has called me over to see why a page was failing with Ambiguous Match Exception yellow screen of death. There was a simple change made to the page, that broke it, I tried the usual trouble shooting methods* (restarting VS & ISS, cursing, etc) but that failed to fix it. I moved to code to my machine and verified that it was completely reproducible across machines. Then we started to pick apart the changes, literally line by line.

The problem turned out to be this line:

IList<string> products = new List<string>();

Only then we remembered that the page also had a text box called "Products", which apparently caused the WebForms Parser to choke and die. Really nice way to make sure that we would both lose over an hour of work, trying to find the root cause of an opaque problem.

* Take it for what it worth, but I am sad that I know that in many cases, those methods actually work...