I have an app the when reaches a certain point just crashes without any error message other than “AppName stopped working”.
Same thing in the debugger… But if I insert some breakpoints near the crashing situation then it does not crash… SO I can’t find what’s causing the crash…
What seems to make the app crash is the process of selecting a row in a listbox and assigning a variable with some of that listbox cell content and immediately closing tha listbox…
I am now commenting line by line… to try and find the problem… and ideas ?
UPDATE : IF I don’t do a self.close after assigning the value to the variable… the crash seems to go away…
UPDATE2: The problem is somehow related the code in the close event in the window that holds the listbox
Make sure when you run this in the debugger you have “break on exceptions” enabled
Unless its a hard crash (not an exception) this should stop on the code that is causing the problem
I almost never run without this on
A hard crash (where the app just exits) is much harder to catch or diagnose
I couldn’t find the problem… I had to put a button to close the window manually instead of closing it right after the selection was done in the listbox…
One trick I use to debug hard crashes is to go step by step through a method (put the breakpoint at the top) - the app will not crash until you get to the line that’s doing so.
sometimes simply sprinkle system,debuglog’s all around where you suspect things are going wrong helps
you have to watch this using either console on OS X or debugview on WIndows
BUT since if you debug it does NOT do this suggests very strongly you have an event order or event timing bug
Sub Debug(Text as String)
DebugLabel.Text = Text
DebugLabel.Refresh
End Sub
Then put a Debug("MethodName") in every method or event being called. Once you find out what method the crash is occurring in you can put a debug before every line of code.
I used “go away” because didn’t test it much.
Not sure how can I fix the crash.
Can anyone enlighten me on how to detect/recognize event order bugs. ?
Thanks
They’re hard to track down and often manifest themselves as “crashes/gets exceptions when built & but not in debug”
Often what I end up doing is resorting to inserting System.Debuglog where I suspect and then running and watching Console on OS X (or DebugView on Windows)
Its whats affectionately known as “printf debugging”