Nhibernate Nunit Framework Exception

306 views Asked by At

I get the error below when running my tests from command line. I use re-sharper for my test environment. When I run from VS2015, all the tests pass. But when I run them from command line using nunit framework the configuration setup fails. My current project is in .NET 4.6.2.

SetUp : System.TypeInitializationException : The type initializer for 'NHibernate.Cfg.Configuration' threw an exception.
        System.TypeInitializationException : The type initializer for 'NHibernate.LoggerProvider' threw an exception.
        System.ApplicationException : Unable to instantiate: NHibernate.Log4NetLoggerFactory
        System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
        System.TypeInitializationException : The type initializer for 'NHibernate.Log4NetLoggerFactory' threw an exception.
        System.NullReferenceException : Object reference not set to an instance of an object.
      at NHibernate.Cfg.Configuration.Reset() in C:\Projects\nhibernate-core\src\NHibernate\Cfg\Configuration.cs:line 177

I encountered this issue when I upgraded from Nhibernate 2.0 to Nhibernate 4.0. I'm able to run the tests using version 2.0 dll of Nhibernate.

1

There are 1 answers

0
Abhishek On

I have updated the test framework build file to run the tests on the latest nunit.framework.dll. (not the reference to the test project).