How do I locate an error in my code if my app just closes and crashes without an exception?
Thanks
How do I locate an error in my code if my app just closes and crashes without an exception?
Thanks
did you put code in the UNHANDLED EXCEPTION event of the APP object?
this doesn’t ALWAYS catch things, but sometimes
here is what I have in most of my apps
Dim d As New Date
Dim f As New FolderItem
f = SpecialFolder.Desktop.Child(App.ExecutableFile.DisplayName+"_ERRORLOG.txt")
If f.exists Then f.delete
Dim t As TextOutputStream
t=textoutputstream.create(f)
If t = Nil Then Return False
t.WriteLine "UnhandledException: " + Introspection.GetType(error).Name + EndOfLine
t.WriteLine "Current date: " + d.SQLDateTime + EndOfLine + EndOfLine
t.WriteLine "Executable Name: " + App.ExecutableFile.DisplayName
t.WriteLine "Executable Path: " + f.NativePath + EndOfLine
t.WriteLine "Executable Size: " + Str( App.ExecutableFile.Length )
t.WriteLine "Executable ModificationDate: " + App.ExecutableFile.ModificationDate.SQLDateTime
t.WriteLine "Executable CreationDate: " + App.ExecutableFile.CreationDate.SQLDateTime + EndOfLine
t.WriteLine "Call Stack: " + EndOfLine
t.WriteLine "Stack: " + EndOfLine + Join( error.Stack, EndOfLine)
t.Close
myMsgBox "An error occured "+ Introspection.GetType(error).Name + "^^A error log has been saved under " + EndOfLine + f.NativePath +"^^App will be closed.",16
f.Launch
Quit
I’m locking this thread, since the discussion is duplicated here:
https://forum.xojo.com/24031-when-xojo-app-closes-without-exception