Got this response from Atif Aziz (Elmah Lead contributor) to google ELMAH
When you use Task.Run, the HttpContext is not transferred to the thread pool thread where your action will be executed. When ErrorSignal.FromCurrentContext is called from your action, I assume that it probably does not work with another exception, because there is no current context. This exception lies in the Problem. If you're on .NET 4, you're in luck because you will end up with an ASP.NET application application (but maybe a lot after the fact) when the GC launches and collects the task and its exception will be “unobservable.” If you are using .NET 4.5, the policy has been changed, and the exception is simply lost. In any case, your observation will be that the mailing does not work. In fact, logging will not work if you do not use Elmah.ErrorLog.GetDefault (null ) .Log (new error (ex)), where context zero is allowed, but this call only registers but it doesn’t perform any mailings. ELMAH modules are connected to the ASP.NET context. If you separate from this context by clicking on another thread, you cannot rely on ELMAH modules. You can use Elmah.ErrorLog.GetDefault (null) .Log (new error (ex)) reliably log the error.
source share