Crash Protection for Xojo methods
Sometimes you may have a situation, where you want to try something, that may crash. This may be a problem outside your control like a system or library function. Or some pointer reading may cause a page fault and you like to try it. Or some code produces crash reports for your users and you like to catch it and show a bug reporter dialog to get more details on why it crashes in a method.
We got recently a CallDelegateCrashSafeMBS module with a CallDelegateCrashSafeMBS method, that calls a method on your behalf. If it crashes, we raise a DelegateCrashExceptionMBS to inform you about it. The error message may tell the error like: "Delegate crashed with invalid pointer access."
When the crash happens on macOS and Linux, we print a stack trace on the console. That may help if you run the application from Terminal window. Then you can see the stack trace printed. The stack trace within the exception is from the point where it is raised, but that is not the point where the crash happened.
Here is some example code, where we crash within a test method with a nil pointer:
Please try. Maybe you have a need for some crash protection?
New class included in current 22.6pr1 plugins.