I cannot create a failing test, here is my attempt:
[Test]
public void Can_roll_back_transaction()
{
var tx = new TransactionScope();
using (var s = sessions.OpenSession())
{
new ForceEscalationToDistributedTx(true);//will
rollback tx
s.Save(new Person
{
CreatedAt = DateTime.Today
});
tx.Complete();
}
try
{
tx.Dispose();
Assert.Fail("Expected tx abort");
}
catch (TransactionAbortedException)
{
//expected
}
}
On Apr 19 2008, 5:33 pm, John Rayner <[email protected]>
wrote:
> We have a WCF service endpoint which connects to NHibernate and
> sometimes we flow transactions over the WCF connection. In these
> cases, our database connection enlists in the distributed
> transaction. I recently got an w3wp.exe crash on an unhandled
> exception which was raised in NHib code. The stack trace is below,
> but unfortunately the error is not reproducible.
>
> I've been unable to find any mention of similar exceptions on the
> web. Has anyone seen this? Should I post it to the NHib JIRA?
>
> Cheers,
> John Rayner
>
> An unhandled exception occurred and the process was terminated.
>
> Application ID: /LM/W3SVC/1/ROOT/RRA.Beacon.Recruiter.DevService
>
> Process ID: 1312
>
> Exception: System.InvalidOperationException
>
> Message: Collection was modified; enumeration operation may not
> execute.
>
> StackTrace: at
> System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource
> resource)
> at System.Collections.Generic.List`1.Enumerator.MoveNext()
> at NHibernate.Engine.ActionQueue.AfterTransactionCompletion(Boolean
> success) in C:\Projects\Russell Reynolds\Solution\Main\Solutions
> \ExternalProjects\NHibernate\src\NHibernate\Engine\ActionQueue.cs:line
> 177
> at NHibernate.Impl.SessionImpl.AfterTransactionCompletion(Boolean
> success, ITransaction tx) in C:\Projects\Russell Reynolds\Solution\Main
> \Solutions\ExternalProjects\NHibernate\src\NHibernate\Impl
> \SessionImpl.cs:line 344
> at
> NHibernate.Impl.AbstractSessionImpl.<EnlistInAmbientTransactionIfNeeded>b__
> 0(Object
> sender, TransactionEventArgs e) in C:\Projects\Russell Reynolds
> \Solution\Main\Solutions\ExternalProjects\NHibernate\src\NHibernate
> \Impl\AbstractSessionImpl.cs:line 286
> at
> System.Transactions.TransactionCompletedEventHandler.Invoke(Object
> sender, TransactionEventArgs e)
> at System.Transactions.InternalTransaction.FireCompletion()
> at
> System.Transactions.TransactionStatePromotedAborted.EnterState(InternalTran
> saction
> tx)
> at
> System.Transactions.TransactionStatePromotedBase.ChangeStatePromotedAborted
> (InternalTransaction
> tx)
> at
> System.Transactions.InternalTransaction.DistributedTransactionOutcome(Inter
> nalTransaction
> tx, TransactionStatus status)
> at
> System.Transactions.Oletx.RealOletxTransaction.FireOutcome(TransactionStatu s
> statusArg)
> at
> System.Transactions.Oletx.OutcomeEnlistment.InvokeOutcomeFunction(Transacti
> onStatus
> status)
> at
> System.Transactions.Oletx.OletxTransactionManager.ShimNotificationCallback(
> Object
> state, Boolean timeout)
> at
> System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(
> Object
> state, Boolean timedOut)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---