hello, Can NHibernate exit your app without throwing an exception?
I'm debugging a console app and
Code:
void main(...)
{
try {
IPerson oParent = LoadPerson(123);
} catch(Exception ex)
{
Console.WriteLine(ex.ToString()); // this was never hit!?
}
return;
}
public IPerson LoadPerson(long nId)
...
try {
// DAO call which uses NHibernate ISession.Get(nId). Then "Children" are retrieved by another mechanism, but initial ISession.Get and subsequent loading of children are two separate member functions wrapped under single transaction scope (i.e. not NHibernate... long story short, it uses a self-referencing table to hold parent-child relationship. This table uses a different mapping file. Retrieved oChild.Parent is set to oParent which I think is... the primarily culprit)
using (oScope = new TransactionScope(TransactionScopeOption.Required))
{
IPerson oParent = Session.Get(nId);
LoadChildren(oParent);
foreach(IPerson oChild in oParent.Children)
{
oChild.Parent = oParent; // If I comment out this line my app won't "exit silently" (not immediately, but after exit from "LoadPerson")!! Question is why!?
oChild.Parent = new Person(); // Event this would save the app from silently exiting (after exit from "LoadPerson")
}
}
} catch (Exception ex)
{
Console.WriteLine(ex.ToString()); // this was never hit?!
}
returns oParent;
}
Any suggestion as to posssibility of NHibernate causing my WIN32 console app to exit silently? I have catch(Exception) on all levels but still I didn't manage to catch any exception and therefore don't know what killed it... I initially suspected loading children is a recursive ops but if infinitely recursion was the cause of death I should have a StackOverflowException do I? But I have nothing. I understand you can't "catch" a StackOverflowException" but still if you run app on debugger, debugger will be able to tell you that under all circumstances right? I think OutofMemory is another example... (I tested this on another simple toy app)
I dunno, pretty clueless, not sure if it's somewhere recursive voodo gone wrong or .... all i know is if i don't do this app is fine (but you'd lose parent<-Child directional link.
Code:
oChild.Parent = oParent;
Many thanks.