When it comes to application error handling, there are two major schools of thought. Some believe that you should show the end-user as little detail as possible, instead logging the full error information somewhere. Others think that you should dump as much information as possible when the program crashes since the end-user won't understand what it means anyway. Today, we can scratch one for the "little info" team:

[ArgumentException: 
   Item has already been added.  
   Key in dictionary: "data source=DTESQL04.INITECH-GLOBAL.COM;initial catalog=BCPCMS;user id=cmsadmin;password=flTSP4#1;"
   Key being added: "data source=DTESQL04.INITECH-GLOBAL.COM;initial catalog=BCPCMS;user id=cmsadmin;password=flTSP4#1;"]
 System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +931
 System.Collections.Hashtable.Add(Object key, Object value) +11
 Initech.BcpCms.Data.ConnectionManager.EnsureConnection(ConnectionProvider provider, String connectionString) +667
 [ -- SNIP -- ]
 System.Web.UI.Control.Render(HtmlTextWriter writer) +7
 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
 System.Web.UI.Page.ProcessRequestMain() +1918
 

Wiebe Tijsma was tasked to find out why so many users were reporting this issue. As it turns out, the offending code really wasn't bad. It just neglected to account for a situation where more than one person would be using the application at the time ....

protected static void EnsureConnection(ConnectionProvider provider, string connectionString)
{
  if (!activeConnections.ContainsKey(connectionString))
  {
    DataConnection conn = CreateConnection(provider.ConnectionType); 
    activeConnections.Add(connectionString, conn);
  }
}

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!