This project has moved. For the latest updates, please go here.
3

Closed

Crash when trying to "Send Report"

description

I am creating a WPF application. I was testing the "Send Report" functionality and it seems like it is just not working. It crashes with a null reference exception when I click "send". I am calling the "Report" from the "On Exit" of the WPF app, so maybe that has an impact in it.

at CrashReporterDotNET.CrashReport.CreateReport(Exception exception)
at CrashReporterDotNET.CrashReport.HtmlReport()
at CrashReporterDotNET.CrashReport.ButtonSendReportClick(Object sender, EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at CrashReporterDotNET.ReportCrash.Send(Exception exception)
at HaathiSoftware.MusicEditor.UI.LogReporter.ReportError(Exception ex, Boolean exit) in c:\Code\HaathiMusicEditor\Releases\1.0\HaathiMusicEditor\HaathiMusicEditorUI\App.xaml.cs:line 162
Closed Aug 9, 2014 at 6:17 AM by ravi15

comments

pstrjds wrote Aug 5, 2013 at 11:03 PM

I figured out where the bug is. In the CreateReport(Exception ex) method, there is a line that is HtmlEncoding the Exception.StackTrace. In some cases the stack trace can be null. In the case of a null stack trace, HtmlEncode will return a null string. You get the null reference exception from this line:
HttpUtility.HtmlEncode(exception.StackTrace).Replace("\r\n", "<br/>"))
It is easily corrected by adding a null coalescer
HttpUtility.HtmlEncode(exception.StackTrace ?? string.Empty).Replace("\r\n", "<br/>"))

1005470 wrote Nov 22, 2013 at 9:12 AM

Has or will this be fixed soon?

wrote Feb 20, 2014 at 7:39 PM

wrote Mar 19, 2014 at 8:36 PM

ravi15 wrote Aug 3, 2014 at 5:22 AM

I will fix this asap. Sorry for very late reply.

wrote Aug 9, 2014 at 6:17 AM

wrote Aug 9, 2014 at 6:17 AM