Why getting System.TypeInitializationException was unhandled by user code error when calling EnterpriseLibraryContainer.Current.GetInstance<LogWriter>()?

Apr 3, 2012 at 8:58 PM

I use LAB in my component without any problem. However, when I created my test project in VS 2010 for my component, I got System.TypeInitializationException was unhandled by user code error when calling EnterpriseLibraryContainer.Current.GetInstance<LogWriter>(). My component calls my logging class static method, which calls LAB method. Now my test method calls my component, which calls LAB method. Why it failed?

Thanks in advance,

Cindy

Apr 3, 2012 at 10:08 PM

I figured it out. My test project has to have app.configure.