Skip to content

Exception when using envers with the latest logging changes #1478

Closed
@lnu

Description

@lnu

We're using envers and now it fails with this error at runtime:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at NHibernate.LoggerProvider.LoggerFor(Type type)
   at NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder..cctor()
   --- End of inner exception stack trace ---
   at NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder.addToEnti
tyMeta(AuditMappedByAttribute attribute, EntityMeta entityMeta, MemberInfo membe
rInfo)

It's the related to the new logging refactoring. I guess it will also fails with other libraries.

[Obsolete("Use NHibernateLogger.For() instead.")]
public static IInternalLogger LoggerFor(System.Type type)
{
    return _legacyLoggerFactory.LoggerFor(type);
}

it fails because the _legacyLoggerFactory is null

edit: I did the changes in envers to use the new logging(NHibernateLogger.For') and it wokrs. But in the meantime it should work with the old version wihtout any issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions