Today, my colleague Thierry Thoua has shown me a bug in one of the .NET framework class. If you look in the Lutz Roeder's Reflector for the CompilerType.Equals method, you should see something like:
public override bool Equals(object o)
{
CompilerType type = o as CompilerType;
if (o == null)
{
return false;
}
return ((((this._codeDomProviderType == type._codeDomProviderType)
&& (this._compilParams.WarningLevel == type._compilParams.WarningLevel))
&& (this._compilParams.IncludeDebugInformation == type._compilParams.IncludeDebugInformation))
&& (this._compilParams.CompilerOptions == type._compilParams.CompilerOptions));
}
what happens ? Of course as they do not check "type" for nullity, but for "o" instead, you may have a NullReferenceException. Apparently he has seen such a bug in some other classes in the .NET framework. Maybe some more information on his blog ?