Recently, while digging on ASP.NET 2.0 Health Monitoring I found a bug in the EventMappingSettingsCollection.Contains class method.
I was trying to check if an event mapping already exists but every time I try it the following exception was thrown:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
at System.Web.Configuration.EventMappingSettingsCollection.GetElementKey(ConfigurationElement element)
at System.Configuration.ConfigurationElementCollection.GetElementKeyInternal(ConfigurationElement element)
at System.Configuration.ConfigurationElementCollection.BaseIndexOf(ConfigurationElement element)
at System.Web.Configuration.EventMappingSettingsCollection.IndexOf(String name)
at System.Web.Configuration.EventMappingSettingsCollection.Contains(String name)
I opened a bug in connect, so, if you think this is important go there and vote.
And if you think this one is not a common error ... well ... this is the second bug I found regarding Contains method from a collection class.