Another encounter "xxx type initializer throws an exception"
Under a lightweight IOC open-source project implemented in C #, but when used locally, it was discovered that a run caught " type initializer throws an exception" exception information, debugging several times or not to determine exactly where the problem. The impression seems to have encountered this anomaly, the initial estimate is a static class initialization is not successful, but not sure.
Helpless open ilspy View source, found that static initialization of a lot of places, and the code appears layered nested, the class name is numerous, one line to follow up easily around Halo. Toss for a long time did not, but Google, found long ago someone and I met the same problem, a look at the most votes the right solution almost did not go crazy: The project directly add Log4net.dll reference can be.
After testing, sure enough.
Ah ah ah ah ah ah ah ah ah ah ...
Originally is Log4net, unexpectedly is log4net again.
According to personal experience, many open source projects use Log4net to log logs, such as I have encountered when using Ibatis.net, Postsharp, Fastdfs C # client and memcached C # Implementation of a client.
Will the next time you encounter the same problem can quickly find the cause? Can you stop wasting your time? Can you do something more valuable?
Or is it a lack of log4net references? Kao, God knows.
Memcached Memcached.ClientLibrary.SockIOPool "type initializer throws an exception