When I run my app with with “Break on Exceptions” enabled, when I click the close window button on the window, it breaks as if there was an exception, BUT there is nothing in the stack trace other than “Event loop”. When I dig around the variables, in Runtime->Contents there is a NilObjectException but the Error Number is 0 and there is no Message. If I resume running the app, it keeps breaking. If do it over and over again (around 10 times!), eventually it doesn’t break, but the window actually never closes and my app is still running…
There is a bit of code in this window’s close event, I’ve set a breakpoint in there but it is never reached. If I disable “Break on exceptions”, the code does get reached however, the window closes as expected.
However, I am trying to get Profiler data and that never shows up in the IDE, which leads me to believe that the app might not be finishing cleanly but rather silently crashing (hence the lack of Profile data).
I’m stumped as to what may be causing this. Kind of hard without a stack track … Ideas !!!
(This is a relatively large app, this is happening in Windows - I don’t have a Mac so I don’t know how it behaves there)
The code in the close event does not manipulate any controls from that specific window, but it does call close on a bunch of other windows. Could that be it ? (I guess I can try it easily enough )
Hmmm, that could be pretty tricky - it’s a fairly complex corporate app with a handful of plugins and several external data dependencies that would not be trivial to get going with…
[quote=85686:@Kem Tekinay]As an aside, if you’re quitting anyway, why do you need all of those steps?
It’s time to start adding DebugLog items to your methods so you can narrow it down.[/quote]
At some point we had a window hanging around even after the main got closed, keeping the app running… so we just stuck that in there to clean up… Things worked fine (app shutdown, still with exception of course) after I commented them out so they may not be necessary any longer but I don’t think it hurts to have them in there…
Don’t know if this is related, but I give it a shot anyway. I have just ported an app over to 2014r1.1 from 2012r2.1 and had the exact same problem. The culprit was the Database.Close() command that took some time to complete and probably broke many things.
My solution was to close the database in CancelClose, set a flag, start a 250 ms timer and from the time close the window “again” as the flag is now set.
I read somewhere that the database actions were now lifted off to a separate Thread. Threads and closing windows are a nasty combo.
That being said, for whatever reason even tho the exception in the event loop still occurs, Xojo now has started giving me profiling data regardless. It’s pretty weird and buggy - it didn’t before - but I got what I was after originally…
I have a similar problem. Previously, these errors were not. Now, I do not know whether because of the large program. When closing windows, reporting the error.
Example: Closing a window Oprogramu and return to the main window Tarok: