[UIKit] Wrap the call to UIApplicationMain in a @try/@catch handler. - #15746
Conversation
Wrap the call to UIApplicationMain in a @try/@catch handler, and convert any Objective-C exceptions to a managed exception. This way the managed Main method (which calls UIApplication.Main) will be able to catch any Objective-C exceptions.
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ Generator diffGenerator diff is empty Pipeline on Agent |
💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻✅ All tests on macOS Mac Catalina (10.15) passed. Pipeline on Agent |
❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌Failed tests are:
Pipeline on Agent |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 1 tests failed, 222 tests passed. Failures❌ mmp testsDetails
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
|
Test failure is unrelated (https://github.com/xamarin/maccore/issues/2612). |
chamons
left a comment
There was a problem hiding this comment.
Any reason we couldn't do this for NSApplicationMain as well?
|
@chamons it's less useful, because NSApplicationMain (or other method slightly further up the stack, I don't remember exactly) will catch any Objective-C exceptions and just ignore them (so the exceptions would never reach our custom code). |
Wrap the call to UIApplicationMain in a @try/@catch handler, and convert any
Objective-C exceptions to a managed exception.
This way the managed Main method (which calls UIApplication.Main) will be able
to catch any Objective-C exceptions.