I’m replacing Elmah with Exceptional, but having an issue. It works fine if the exception is thrown inside my web project or if the error is a 404 (The controller for path '/blah/blah' was not found or does not implement IController).
But if I throw an exception from within one of my referenced projects that’s not my web project, then Exceptional throws an error when attempting to log. The following error and stacktrace only gets displayed in the console. The error gets swallowed at that point and doesn't get logged anywhere.
One of the beauties of open-source, is that I can see the code that’s throwing the exception, but no idea why…
Exception thrown: 'System.ArgumentException' in Cms.Services.dll 'w3wp.exe' (CLR v4.0.30319: /LM/W3SVC/1/ROOT/wssp-18-131152201224510365): Loaded 'C:WindowsassemblyGAC_MSILMicrosoft.VisualStudio.Debugger.Runtime14.0.0.0__b03f5f7f11d50a3aMicrosoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.HttpRequest.CalcDynamicServerVariable(DynamicServerVariable var) at System.Web.HttpServerVarsCollectionEntry.GetValue(HttpRequest request) at System.Web.HttpServerVarsCollection.GetServerVar(Object e) at System.Web.HttpServerVarsCollection.Get(Int32 index) at System.Web.HttpServerVarsCollection.GetValues(Int32 index) at System.Collections.Specialized.NameValueCollection.Add(NameValueCollection c) at StackExchange.Exceptional.Error.<>c__DisplayClass22_0.b__0(Func2 getter) in C:BuildAgentworkd20fce4a5bb47bd3StackExchange.ExceptionalError.cs:line 126 at StackExchange.Exceptional.Error.SetContextProperties(HttpContext context) in C:BuildAgentworkd20fce4a5bb47bd3StackExchange.ExceptionalError.cs:line 135 at StackExchange.Exceptional.Error..ctor(Exception e, HttpContext context, String applicationName) in C:BuildAgentworkd20fce4a5bb47bd3StackExchange.ExceptionalError.cs:line 107 at StackExchange.Exceptional.ErrorStore.LogException(Exception ex, HttpContext context, Boolean appendFullStackTrace, Boolean rollupPerServer, Dictionary2 customData, String applicationName) in C:BuildAgentworkd20fce4a5bb47bd3StackExchange.ExceptionalErrorStore.cs:line 611
I am registering Exceptional like this:
string coectionString = System.Configuration.ConfigurationManager.CoectionStrings["MyApp"].CoectionString;
ErrorStore.Setup("MyApp", new SQLErrorStore(coectionString));
And this is the only code in my web.config:
<modules runAllManagedModulesForAllRequests="true">
<add name="ErrorStore" type="StackExchange.Exceptional.ExceptionalModule, StackExchange.Exceptional" />
</modules>
