[PersistenceConversation(ConversationEndMode = EndMode.End)]
public void AcceptAll()
{ }
My problem is that it is throwing a NullReferenceException:
System.NullReferenceException: Object reference not set to an instance
of an object.
at uNhAddIns.Adapters.Common.AbstractConversationInterceptor.DisposeConversationOnException()
in c:\Documents and
Settings\HP_Administrator\Desktop\uNHAddins\uNhAddIns\uNhAddIns.Adapters.Common\AbstractConversationInterceptor.cs:line
156
at uNhAddIns.CastleAdapters.AutomaticConversationManagement.ConversationInterceptor.Intercept(IInvocation
invocation) in c:\Documents and
Settings\HP_Administrator\Desktop\uNHAddins\uNhAddIns\uNhAddIns.CastleAdapters\AutomaticConversationManagement\ConversationInterceptor.cs:line
46
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at IUserDalProxy1515046b0bf04a9ba6f4eecb85f833a9.AcceptAll()
at TEAMSLogic.Impl.UserLogic.AcceptAll() in
C:\Source\TEAMS\TEAMS\TEAMSLogic\Impl\UserLogic.cs:line 31
at TEAMSDataUnitTests.UserTests.CanCreateUser() in
C:\Source\TEAMS\TEAMS\TEAMSUnitTests\UserTests.cs:line 51
I copied the query that NHibernate created and did the query in SQL
Server and it worked just fine so I am not sure where the
NullReferenceException is coming from.
Any guidance would be helpful!
Thanks,
Josh
That is my call to Accept all it is
userLogic.AcceptAll();
I have stepped through and I know it is not null. I also call
userLogic.Save() right before it and it works fine.
I did find this though, I was stepping through the debugger and in the
method DisposeConversationOnException var cca is being assigned
ConversationsContainerAccessor and when looking at that property
there is the property Container and inside the container there is a
CurrentConversation property that is null. Would that be throwing
this exception? If so, why is that null?
Thanks,
Josh
But I do have a possible bug in uNHAddins:
If AbstractConversation.EncloseWithExceptionManagement throws an error
when trying to perform action() it throws a new ConversationException
exception which is caught by the try catch block in
ConversationInterceptor.Intercept which the catch clause calls
DisposeConversationOnException which subsequently calls
AbstractConversationContainer.Unbind however everything has already
been unbound so Unbind returns null which then you try to run
Dispose() on that null which in turn throws the unhelpful
NullReferenceException and it loses the stack trace that allows me to
find the actual problem.
It seems the conversation should be unbound after successful
completion of the action or there needs to be a null check in the
DisposeConversationOnException method.
Thanks,
Josh
Here is the proper patch file....I have compiled and tested, and now
instead of the previous exception I receive this one which is MUCH
more informative:
uNhAddIns.SessionEasier.Conversations.ConversationException: Exception
during persistent conversation End:could not insert:
[TEAMS_ORM.User#10256384][SQL: INSERT INTO dbo.tblUsers (FirstName,
LastName, UserName, Password, EmailAddress, RequirePasswordChange,
UserAdded, DateAdded, Active, UserID) VALUES (?, ?, ?, ?, ?, ?, ?, ?,
?, ?)] ---> NHibernate.Exceptions.GenericADOException: could not
insert: [TEAMS_ORM.User#10256384][SQL: INSERT INTO dbo.tblUsers
(FirstName, LastName, UserName, Password, EmailAddress,
RequirePasswordChange, UserAdded, DateAdded, Active, UserID) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] --->
System.Data.SqlClient.SqlException: String or binary data would be
truncated.
Thanks,
Josh