Exception not sent to Raygun because of unhandled exception in RaygunEnvironmentMessageBuilder.Build()
dbruning
Posted on
Aug 01 2019
Hi,
I was trying to reproduce an out-of-memory error in my application, and happily I was able to do it - but I didn't see the error show up in Raygun.
Event viewer showed me that was because Raygun itself threw an error while collecting environment details. Here's the stack trace:
Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileLoadException at Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.Build() at Mindscape.Raygun4Net.RaygunMessageBuilder.SetEnvironmentDetails() at Mindscape.Raygun4Net.RaygunClient.BuildMessage(System.Exception, System.Collections.Generic.IList1<System.String>, System.Collections.IDictionary, Mindscape.Raygun4Net.Messages.RaygunIdentifierMessage, System.Nullable
1
I had a quick look at the source for the Build() method (hopefully that's the right place) and I can see that it's trying to catch and swallow errors. The "swallow" part is actually logging to System.Diagnostics.Trace(), so I wonder if that is throwing the exception that ends up terminating my application? Might be a good idea to wrap the trace() calls too.
If the process is so low on memory that it can't even output a diagnostics trace, then maybe it wouldn't be able to make the HTTP request to Raygun anyway - but you may be able to come up with a better degradation scenario than just bringing down the application at this point.
I'm using Mindscape.Raygun4Net 5.5.4
ubermouse
Posted on
Aug 02 2019
Hi there,
We have created a bug ticket to investigate this problem and see if we can improve the behaviour in this situation. I can't give a definite ETA on when we will start working on it but it will be soon.
We will update you when we have released a new version of Raygun4Net with improved behaviour.
Regards, Taylor