Can anyone provide insight into what scenarios may cause the UpgradeLock to have a null Exception.
In code I had a cached entity with child collection, the code executes:
Code:
UnitOfWork.CurrentSession.Lock(project,LockMode.None)
Changing code to use CurrentSession.Update(project) is my workaround for the time being.
and crashing with the following: (Not sure of the svn rev number of NH (2.x), I am using the version in rhino commons as of a few days ago)
Code:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at NHibernate.Event.Default.AbstractLockUpgradeEventListener.UpgradeLock(Object entity, EntityEntry entry, LockMode requestedLockMode, ISessionImplementor source) in d:\OSS\nhibernate\src\NHibernate\Event\Default\AbstractLockUpgradeEventListener.cs:line 29
at NHibernate.Event.Default.DefaultLockEventListener.OnLock(LockEvent event) in d:\OSS\nhibernate\src\NHibernate\Event\Default\DefaultLockEventListener.cs:line 55
at NHibernate.Impl.SessionImpl.FireLock(LockEvent lockEvent) in d:\OSS\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 1914
at NHibernate.Impl.SessionImpl.Lock(Object obj, LockMode lockMode) in d:\OSS\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 525
at NHibernate.Engine.Cascades.CascadingAction.ActionLockClass.Cascade(IEventSource eventSource, Object child, Object anything) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 131
at NHibernate.Engine.Cascades.Cascade(IEventSource eventSource, Object child, IType type, CascadingAction action, CascadeStyle style, CascadePoint cascadeTo, Object anything) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 477
at NHibernate.Engine.Cascades.CascadeCollection(CascadingAction action, CascadeStyle style, CollectionType collectionType, IType elemType, Object child, CascadePoint cascadeVia, IEventSource eventSource, Object anything) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 597
at NHibernate.Engine.Cascades.Cascade(IEventSource eventSource, Object child, IType type, CascadingAction action, CascadeStyle style, CascadePoint cascadeTo, Object anything) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 497
at NHibernate.Engine.Cascades.Cascade(IEventSource eventSource, IEntityPersister persister, Object parent, CascadingAction action, CascadePoint cascadeTo, Object anything) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 558
at NHibernate.Engine.Cascades.Cascade(IEventSource eventSource, IEntityPersister persister, Object parent, CascadingAction action, CascadePoint cascadeTo) in d:\OSS\nhibernate\src\NHibernate\Engine\Cascades.cs:line 530
at NHibernate.Event.Default.DefaultLockEventListener.CascadeOnLock(LockEvent event, IEntityPersister persister, Object entity) in d:\OSS\nhibernate\src\NHibernate\Event\Default\DefaultLockEventListener.cs:line 64
at NHibernate.Event.Default.DefaultLockEventListener.OnLock(LockEvent event) in d:\OSS\nhibernate\src\NHibernate\Event\Default\DefaultLockEventListener.cs:line 52
at NHibernate.Impl.SessionImpl.FireLock(LockEvent lockEvent) in d:\OSS\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 1914
at NHibernate.Impl.SessionImpl.Lock(Object obj, LockMode lockMode) in d:\OSS\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 525
at Qfrs.ProjectRegister.Application.CostPresenter.CheckAndBindProject() in D:\Inetpub\ORPUDev\src\Qfrs.ProjectRegister.Application\CostPresenter.cs:line 63
I don't currently have a test around this but I'll try and get one to reproduce if possible.
Regards,
Jason