Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Production Debugging

Tags:

.net

debugging

I've had a Windows app in production for a while now, and have it set up to send us error reports when it throws exceptions. Most of these are fairly descriptive and help me find the problem very quickly (I use the MS Application Exception Block).

On a few occasions I have reports that are issues that I can't reproduce, and seem to only happen on a few client machines.

I don't have physical access to these client machines, what are some strategies I can use for debugging? Would it be better to build some tracing into the code, or are there some other alternatives?

Thank you.

Edit: I should have been more clear: The error reports that I get do have the stack trace, but since it's production code, it doesn't indicate the exact line that caused the exception, just the method in which it was thrown.

like image 641
Jon Dewees Avatar asked Sep 09 '08 20:09

Jon Dewees


People also ask

Can you debug in production?

Production debugging, as the name suggests, takes place when one must debug the production environment and see the root cause of this problem. This is a form of debugging that can also be done remotely, as during the production phase, it may not be possible to debug within the local environment of the application.

What is .NET debugging?

ASP.NET MVC 5 for Beginners Debugging allows the developers to see how the code works in a step-by-step manner, how the values of the variables change, how the objects are created and destroyed, etc.

Should you debug in production?

In a long time, it also becomes impossible to recreate the exact environment. Hence, having a way to debug in production is an extremely useful tool, since it eliminates the need to reproduce issues locally. Instead, you can find and resolve the problem on the running system.


2 Answers

One option is to generate a (mini-)dump file as close to the point where the exception is thrown as possible. This article talks about how to do this from managed code.

You could then load the dump file into Visual Studio or WinDbg and examine it with the aid of SOS

like image 91
Rob Walker Avatar answered Oct 07 '22 21:10

Rob Walker


You are on the right track. You need to create a tracking module which logs actions/exceptions locally.

You can then have a button or a menu option that the user can click to either automatically email you this information the moment the issue occurs, or they can have the option to get hold of the file so that they can transfer it to you in any other way.

You can even build-in a diagnostics code to run an integrity check on the system and sends you a report (maybe it runs all your unit tests to see if they work on that system).

like image 40
Vaibhav Avatar answered Oct 07 '22 20:10

Vaibhav