Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: int RunMain(Func<int>, Func<Exception, int>, Action<Exception>)

  • Declared in: RT.Util.Ut

Declaration

public static int RunMain(
    Func<int> main,
    Func<Exception, int> onUnhandledMain,
    Action<Exception> onUnhandledThread = null
)

Summary

Execute the core of the application. In debug mode, exceptions are passed through untouched. In release mode, all exceptions are caught, including those on other threads, and passed on to the specified handlers. Also, the main thread is given the name "Main".

Parameters

Func<int>main A method which executes the core of the application.
Func<Exception, int>onUnhandledMain Method called in case the main method throws an unhandled exception. The return value is what this method will return.
Action<Exception>onUnhandledThread Method called in case a thread other than the one executing the main method throws an unhandled exception. If null, onUnhandledMain will be called instead, and its return value will be ignored.