You are probably getting caught by a delayed dispose on the session, where the TransactionScope.Complete() does cause an eventual disposal of the session, but it does so after you check if the session is available, but before the BeginTransaction. Normal debugging processes will not allow you to see this happening as the TransactionScope.Complete works asynchronously.
John Davidson On Tue, Oct 12, 2010 at 11:20 AM, Mark Wilkins <[email protected]>wrote: > I asked a question last week about using TransactionScope, but I think > my problem may lay elsewhere... > > To the point, as the subject says... > > What can cause session.BeginTransaction() to return null? > > I'm using the session-per-request pattern in ASP.NET. It seems as > though when I try BeginTransaction() after a > TransactionScope.Complete() has been previously called, the > BeginTransaction() results in the transaction == null. > > I do know that the session is still open when I'm calling > session.BeginTransaction(), as I check it before the call is made. > > I would step into the code in debug mode, but the problem doesn't > happen on my dev machine. Both my dev machine and the server where the > issue occurs have DTC configured the same. > > I didn't post the code here (happy to repost it from my > TransactionScope question from last week), in case someone had a quick > answer. > > Thanks, > > Mark > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
