Search This Blog

Wednesday, December 7, 2016

Object reference not set to an instance of an object. Part 2.

Before you get totally overwhelmed with the upcoming major v16.2 release (learn quick about XAF bits there), I want to further discuss troubleshooting errors while debugging your app, which is something any developer has to do regularly regardless of the used development tools.

If you have followed my blog for a long time, you may recall my first post devoted to this problem.
In short, it talks about debugging and analyzing exceptions in Visual Studio or looking into the built-in XAF log file for them. More information on the subject is also available in the online documentation at Concepts > Debugging and Error Handling
Unfortunately, we still receive quite a lot support calls with just this meaningless screenshots like " Object reference not set to an instance of an object" or similar without any callstacks, inner exceptions, loaded assemblies or any other meaningful diagnostic information that would allow us to help users in the most effective manner. Since such a screenshot does not provide any opportunity to the author or us to learn about the underlying cause of the error, an unnecessary clarification turn around and an accompanying delay always occurs in this case... This is certainly bad for both sides and thus is something we seek to avoid.

Possible solution
With v16.2, XAF WinForms apps will display a better error dialog while you are debugging your app:

We have not integrated a similar thing in the Web UI yet because the ASP.NET platform already provides quite a rich error page where the original problem was less noticeable, at least according to our internal figures.

Notice that the extended error form now  not only displays the top-most error message, but also shows the full call stack for you to research or copy to the DevExpress support crew, if necessary. At the bottom, there is also a link to the new help article describing the most common troubleshooting techniques that should help you save time and hunt "bugs" more effectively. In the majority of cases, these pointers should be sufficient to either research/fix your own custom code or submit an effective ticket to the Support Center, if the underlying issue has something to do with DevExpress routines.

This dialog should NOT appear when no debugger is attached to your app, e.g., when your end-users use your app in production - the former dialog will be shown there to avoid any possible confusion concerning technical details, as in previous versions.

Your feedback is needed!
We hope this will help our users and us to eliminate unnecessary delays and speed up overall problems troubleshooting in Visual Studio. As always, we are also looking forward to hearing from you on this small, but necessary service feature. For instance, to better communicate to developers that it is for development time only, we are also thinking about appending something like " (Debugging...)" to the form title, near the app name or adding some clarification tooltip on mouse hover. Or, is it already clear enough? Please let me know what you think. 
I also welcome other thoughts on solving the original problem in case we overlooked something.


  1. Nice one! I would make it More clear that this is only shown Düring Debug - as my First thought also was if this is shown to an end User?

    1. Thanks for sharing your thoughts, Man. Yes, I am also thinking about "XCRM (DEBUG MODE)"

    2. We have added this DEBUG MODE text to the form caption in the latest 16.2 version.