If you don’t have access to the main thread, you can throw the exception on another, non-timer thread:
catch (Exception exception)
{
ThreadPool.QueueUserWorkItem(
_ => { throw new Exception("Exception on timer.", exception); });
}
If you don’t have access to the main thread, you can throw the exception on another, non-timer thread:
catch (Exception exception)
{
ThreadPool.QueueUserWorkItem(
_ => { throw new Exception("Exception on timer.", exception); });
}