MindscapeHQ/raygun4net — pull request #82 by krisdages (2013-09-09 07:50:40+00:00)
Title: Handle missing Request object during Application_Start

Factor out repeated calls to context.Request in Message object; catch and swallow "Request is not available in this context" HttpException that occurs in IIS Integrated Mode during Application_Start and End.

It is not possible to detect from the HttpContext object alone whether the Request is available except by catching the exception upon access or reading an internal property.
http://stackoverflow.com/questions/2609512/

Did not add tests for this because it requires integration testing with an actual web app that throws an exception during Start or End events.