pelton wrote:
Actually, I should be getting StaleObjectException for a windows app, too.
Okay, I seem to be getting this exception, but it is not being caught by any of my catch statements.
The call to NH's SaveOrUpdate looks like this:
Code:
public static void Save(object objectToSave)
{
ITransaction transaction = Session.BeginTransaction();
try {
Session.SaveOrUpdate(objectToSave);
transaction.Commit();
}
catch (NHibernate.StaleObjectStateException staleEx)
{ loging & other stuff here }
catch (NHibernate.HibernateException hEx)
{ loging & other stuff here }
}
Neither of those log statements are called. Ever.
The code that is actually logging the exception is this. I added an exception handler to my forms application:
Code:
System.Windows.Forms.Application.ThreadException += OnThreadException;
...
public static void OnThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
log.Fatal("Unhandled Exception Occured", e.Exception);
}
Why would it bypass all of my exception handlers? That doesn't make any sense.