How to catch all exceptions in the application including the onesfrom 3rd party library RRS feed

  • Question

  • Hi,

    We are trying to log and record all the exceptions when running the application by using below method.

                application.DispatcherUnhandledException += OnUnhandledDispatcherException;
                application.AppDomain.UnhandledException += OnCurrentDomainUnhandledException;

    However, we found certain exceptions are not caught by above event. These are the ones from 3rd party library. Instead handling by our own code, Microsoft .Net Framework throws them directly. Is there a way/event we can use to catch all the exceptions including the ones from 3rd party library? 

    ************** Exception Text **************

    System.NullReferenceException: Object reference not set to an instance of an object.

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRegularRowCell(GridViewDrawArgs e, GridCellInfo ci)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRegularRow(GridViewDrawArgs e, GridDataRowInfo ri)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRowCore(GridViewDrawArgs e, GridRowInfo ri)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRow(GridViewDrawArgs e, GridRowInfo ri)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRows(GridViewDrawArgs e)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawContentsCore(GridViewDrawArgs e)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawCore(GridViewDrawArgs e)

       at DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.Draw(ViewDrawArgs ee)

       at DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e)

       at DevExpress.XtraGrid.Views.Grid.GridView.Draw(GraphicsCache e)

       at DevExpress.XtraGrid.GridControl.OnPaintCore(PaintEventArgs e)

       at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaintCore(Boolean beginPaint, IntPtr hdc, Rectangle rectangle, Rectangle[] clipBounds)

       at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaint(Message& m)

       at DevExpress.XtraGrid.GridControl.CheckProcessMsg(Message& m)

       at DevExpress.XtraGrid.GridControl.WndProc(Message& m)

       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



    Wednesday, December 11, 2019 6:34 AM

All replies

  • Hi HiHiXin,
    We mainly discuss the official issues of Microsoft .Net Framework here. 
    Since your application involves a third party library, it is recommended that you ask its publisher for help.
    Thank for your understanding.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 11, 2019 7:32 AM
  • Hi Daniel,

    It's a general question about how to catch all the exceptions (instead of why exception was thrown), especially the ones from 3rd Party/Native code. The exception I posted is just an example.



    Thursday, December 12, 2019 7:39 AM