Caliburn.Micro
Caliburn.Micro copied to clipboard
Async Methods swallow exceptions
This pull request introduces several changes to improve exception handling across various files in the Caliburn.Micro framework. The most significant changes include adding exception handling mechanisms in asynchronous methods and updating the ResultCompletionEventArgs class to include an exception property.
Exception Handling Enhancements:
-
src/Caliburn.Micro.Core/Screen.cs: Added try-catch blocks inActivateAsync,DeactivateAsync, and other methods to log exceptions and call new virtual methods for handling exceptions. [1] [2] [3] [4] -
src/Caliburn.Micro.Core/ResultCompletionEventArgs.cs: Introduced a private_exceptionfield and a constructor to initialize it.
Coroutine Exception Handling:
-
src/Caliburn.Micro.Platform/Platforms/Android/CaliburnApplication.cs: Added aCoroutineExceptionmethod to handle exceptions during coroutine execution. -
src/Caliburn.Micro.Platform/Platforms/Maui/Android/CaliburnApplication.cs: AddedCoroutineExceptionmethod and updatedInitializemethod to subscribe toCoroutine.Completedevent. [1] [2] -
src/Caliburn.Micro.Platform/Platforms/net46-netcore/Bootstrapper.cs: AddedCoroutineExceptionmethod and updatedInitializemethod to handle coroutine exceptions. [1] [2]
Miscellaneous Changes:
-
src/Caliburn.Micro.Platform/Platforms/Maui/FormsApplication.cs: AddedCoroutineExceptionmethod and updatedInitializemethod to handle coroutine exceptions. [1] [2] -
src/Caliburn.Micro.Platform/Platforms/netcore-avalonia/BootstrapperBase.cs: AddedCoroutineExceptionmethod and updatedInitializemethod to handle coroutine exceptions. [1] [2]
These changes enhance the robustness of the framework by ensuring that exceptions are properly logged and handled, preventing potential crashes and improving debugging capabilities.
Closing #863, #745
@darxis Hope you had a Happy New Year. Could you look at this when you get a chance?