المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : who killed my app!?



C# Programming
03-30-2009, 11:50 AM
(I'm sure the ultimate culprit would be me but ... I still need a scapegoat!)

hello, Can NHibernate exit your app without throwing an exception?

I'm debugging a console app and

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 {
IPerson oParent = Load(nId); // This will call DAO which uses NHibernate ISession.Get(nId). Then "Children" are retrieved by another mechanism (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)

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 the app on debugger, debugger will tell you that right? (I tested this on a separate toy app)

Many thanks

dev