juin 16

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 ?

Tags: |

Commentaires

pe.dautreppe

Posted on mardi, 17 juin 2008 12:24

Check on the blog of Thierry some other related bugs:
blog.lelibre.eu/.../104-les-mysteres-de-equals

Pierre-Emmanuel Dautreppe

Posted on vendredi, 25 décembre 2009 20:10

The post of Thierry can now be found on http://www.lelibre.net/index.php?trackback/103

Ajouter un commentaire




biuquote
  • Commentaire
  • Aperçu immédiat
Loading