i don't think this is a known issue, so if you can create a jira issue with a testcase, that would be great
On Wed, Aug 5, 2009 at 2:03 AM, Tyler Burd <[email protected]> wrote: > So after even MORE exploration, I found out that the problem only occurs > when the connection.release_mode property is set to “on_close”. As soon as > I set it back to “auto” I stopped getting exceptions. > > > > Is this a known issue? Are you not supposed to use on_close together with > System.Transactions? If this is not a known issue I can prepare test cases > to demonstrate it fairly easily. > > > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Tyler Burd > *Sent:* Monday, August 03, 2009 1:42 PM > *To:* [email protected] > *Subject:* [nhusers] RE: system.transactions problem > > > > I’ve done a bit more exploration on this. My sample project used > ActiveRecord to map the classes and initialize NHibernate. When I ripped > out AR and used vanilla NH everything worked as expected. So it looks like > I’ll be doing still more research and moving this post to the castle list > once I find the cause. > > > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Tyler Burd > *Sent:* Monday, August 03, 2009 11:08 AM > *To:* [email protected] > *Subject:* [nhusers] system.transactions problem > > > > I’m having a pretty serious problem with System.Transactions and NH. I am > using the trunk, and I can package up a complete test case if no one knows a > solution off-hand. > > > > Everything works great when I open a session within a TransactionScope, > unless the transaction is promoted due to something else enlisting in the > scope. I have the following test case, with a very simple mapped class. As > you can see, my process is: > > > > 1. Begin a TransactionScope > > 2. Receive and send a MSMQ message > > 3. Open a session > > 4. Do some db work within the session > > 5. Force a rollback by throwing an exception > > 6. Thread.Sleep for 60 seconds. > > > > After about 20 seconds I see the following error occur on another thread: > > > > > System.InvalidOperationException: Disconnect cannot be called while a > transaction is in progress. > > at NHibernate.AdoNet.ConnectionManager.Disconnect() > > in ConnectionManager.cs: line 158 > … > > > > I have tried both Postgresql with the latest Npgsql driver and MS SQL > Server 2005. If I take out the MSMQ stuff so that the transaction is NOT > promoted, everything is fine and dandy. Any ideas? Am I doing something > wrong here? > > > > [Test] > > *public* *void* QuickTransactionScopeTest() > > { > > *var* sessionFactory = GetSessionFactory(); > > > > *using* (*var* tx = > *new*TransactionScope(TransactionScopeOption.RequiresNew)) > > { > > *var* q = > *new*MessageQueue(@".\Private$\somequeue"); > > *var* msg = q.Receive(); > > q.Send(msg, > MessageQueueTransactionType.Automatic); > > > > *using* (*var* sess = > sessionFactory.OpenSession()) > > { > > *try* > > { > > *var*dummy = > sess.Get<TestModel>(1); > > > dummy.TestProperty += "changed!"; > > *throw* * > new* Exception("Roll em back, boys."); > > > tx.Complete(); > > } > > *catch* (Exception e) > > { > > > Console.WriteLine(e); > > } > > } > > } > > > > Thread.Sleep(60000); > > Console.WriteLine("Done!"); > > } > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
