Saturday, June 8, 2013

Tip: Don't use LogManager.GetCurrentClassLogger() when using interception

So this cost me an hour. I had some code that ran perfectly under unit tests. However, in the live application ( that uses Unity with Interception ), I had NullReferenceExceptions when instantiating some of the classes when calling the logger. Turns out, when using interception, it's not a good idea to GetCurrentClassLogger(). That will cause your code to break. Use GetLogger() instead.

No comments:

Post a Comment