Just run into this issue.

What would you expect this to do?



[Test]

public void WillNotCrashOnDtcPrepareFailure()

{

    using(var tx = new TransactionScope())

    {

        using (var s = sessions.OpenSession())

        {

            s.Save(new Person

            {

                CreatedAt = DateTime.MinValue // will cause SQL date failure

            });

        }


        new ForceEscalationToDistributedTx();


        tx.Complete();

    }

}


The problem is that when we fully escalate to distributed tx, the actual
commit is going to happen on a different thread.
If an exception is thrown by the commit, this is going to crash the entire
process.
Now, my problem is that I am not sure what NH's behavior should be in this
regard, because we don't have a good way of reporting the error to the user
at this point.
I am going to commit a fix that will swallow the exception, force a rollback
on the DTC and log an error.
I am not _happy_ about that, but I can't think of anything that will be
better.

Reply via email to