Matt Doller
-
2010-11-29
In looking through the Log4Net logger implementations, I noticed that the WriteInternal methods are locking on Types instead of a related object. I believe that locking on types is considered bad practice, as it can possibly cause deadlocks in other applications using that type (http://bytes.com/topic/c-sharp/answers/249277-dont-lock-type-objects)
Perhaps something like the attached file is preferable? I've created a TypeLocks dictionary which contains a lock object for each type, and lock on that object instead of the Type itself.
Thanks, and keep up the great work!