trying to figure out how exceptions propagate and should be handled.
My Visual Studio 2019 test solution consists of:
1. C++Dynamic Library (.so), Target API Level android-27, exceptions enabled with "-fexceptions" flag
2. Android 9.0 (Pie) test application using library above, in OnCreate method exception handling is added as follows:
AndroidEnvironment.UnhandledExceptionRaiser += (sender, e) => ...
TaskScheduler.UnobservedTaskException += (sender, e) => ...
AppDomain.CurrentDomain.UnhandledException += (sender, e) => ...
When I throw exception in the library:
Android application ends execution. No exception is caught.
What I can see in the Android Device Monitor is:
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '/usr/local/google/buildbot/src/android/ndk-release-r16/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type int" failed'
So it seems that all exceptions should be handled in the C++ code.
In case of external libraries I can write a wrapper and handle exceptions.
Is this is a right way, or did I miss something?
If this is the right way I am looking for a documentation reference confirming it. Assuming there is any.
My test program can be accessed here
modified 27-Nov-19 4:54am.