Skip to content

Can't write CLR type NHibernate.Envers.RevisionType exception after upgrading to Npgsql >= 4.0.0 #3

@wojtek-abakus

Description

@wojtek-abakus

Hello.

Recently we've upgraded our PostgreSQL database driver to version 4.0.2 and Evners started to throw exceptions. It was working fine on 3.x.x branch of the driver.
From exception stacks I can tell that there's some wrong revtype mapping (probably enum is passed instead of enum casted to short).

Stack is:

An exception of type 'NHibernate.AssertionFailure' occurred in NHibernate.dll but was not handled in user code
Additional information: Unable to perform BeforeTransactionCompletion callback
 
   w NHibernate.Engine.ActionQueue.BeforeTransactionCompletionProcessQueue.BeforeTransactionCompletion()
   w NHibernate.Impl.SessionImpl.BeforeTransactionCompletion(ITransaction tx)
   w NHibernate.Transaction.AdoTransaction.Commit()

And the inner exception:

Can't write CLR type NHibernate.Envers.RevisionType with handler type Int16Handler

   w lambda_method(Closure , NpgsqlTypeHandler , Object , NpgsqlLengthCache& , NpgsqlParameter )
   w Npgsql.TypeHandling.NpgsqlSimpleTypeHandler`1.ValidateObjectAndGetLength(Object value, NpgsqlLengthCache& lengthCache, NpgsqlParameter parameter)
   w Npgsql.NpgsqlParameter.ValidateAndGetLength()
   w Npgsql.NpgsqlCommand.ValidateParameters()
   w Npgsql.NpgsqlCommand.<ExecuteDbDataReader>d__100.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
   w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   w Npgsql.NpgsqlCommand.<ExecuteNonQuery>d__92.MoveNext()
--- Koniec śladu stosu z poprzedniej lokalizacji, w której wystąpił wyjątek ---
   w System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   w Npgsql.NpgsqlCommand.ExecuteNonQuery()
   w NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(DbCommand cmd)
   w NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
   w NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
   w NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
   w NHibernate.Action.EntityInsertAction.Execute()
   w NHibernate.Engine.ActionQueue.InnerExecute(IExecutable executable)
   w NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
   w NHibernate.Engine.ActionQueue.ExecuteActions()
   w NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
   w NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
   w NHibernate.Impl.SessionImpl.Flush()
   w NHibernate.Envers.Synchronization.AuditProcess.DoBeforeTransactionCompletion() w D:\stuff\code\envers\Src\NHibernate.Envers\Synchronization\AuditProcess.cs:wiersz 166
   w NHibernate.Envers.Synchronization.AuditProcessManager.<>c__DisplayClass3_0.<Get>b__0() w D:\stuff\code\envers\Src\NHibernate.Envers\Synchronization\AuditProcessManager.cs:wiersz 35
   w NHibernate.Engine.ActionQueue.BeforeTransactionCompletionProcessQueue.BeforeTransactionCompletion()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions