I have a project, fully setup and tested successfully with nHibernate that I am trying to run in debug mode with Visual Studio 2010. Running the project prior to setting up log4net obviously runs fine, but adding the reference to the log4net assembly, the appropriate lines int web\Global.Asax file, and the configuration parameters in the web.config file result in the following error
Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
at line
Configuration configuration = new Configuration().Configure();
in the following block of code
public static ISessionFactory SessionFactory;
public static ISession OpenSession()
{
if (SessionFactory == null) //not threadsafe
{ //SessionFactories are expensive, create only once
Configuration configuration = new Configuration().Configure();
configuration.AddAssembly(Assembly.GetCallingAssembly());
SessionFactory = configuration.BuildSessionFactory();
}
return SessionFactory.OpenSession();
}
I am explicity following this guide: Configure Log4Net for use with NHibernate from the nHibernate project.