<p>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). </p>

<p>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. </p>

<p>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?</p>

<p>Thank you.</p>

<p>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.</p>

[{'answer_id': 52813, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 1, 'selected': False, 'text': '<p>I always use this <a href="http://www.codeproject.com/KB/exception/ExceptionHandling.aspx" rel="nofollow noreferrer">module</a> from Jeff for unhandled exceptions, sending me an email with stacktrace etc.</p>\n'}, {'answer_id': 52823, 'author': 'Carl', 'author_id': 5449, 'author_profile': 'https://Stackoverflow.com/users/5449', 'pm_score': 0, 'selected': False, 'text': '<p>I\'d make use of the event log. Take a look here:</p>\n\n<p><a href="http://support.microsoft.com/kb/307024" rel="nofollow noreferrer">http://support.microsoft.com/kb/307024</a></p>\n'}, {'answer_id': 52825, 'author': 'Vaibhav', 'author_id': 380, 'author_profile': 'https://Stackoverflow.com/users/380', 'pm_score': 2, 'selected': False, 'text': '<p>You are on the right track. You need to create a tracking module which logs actions/exceptions locally.</p>\n\n<p>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.</p>\n\n<p>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).</p>\n'}, {'answer_id': 52827, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 3, 'selected': True, 'text': '<p>One option is to generate a (mini-)dump file as close to the point where the exception is thrown as possible.  This <a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2008/05/28/programmatically-generating-a-dump-file.aspx" rel="nofollow noreferrer">article</a> talks about how to do this from managed code.</p>\n\n<p>You could then load the dump file into Visual Studio or WinDbg and examine it with the aid of <a href="http://dotnetdebug.net/2006/03/20/loading-and-using-sos-from-within-visual-studio/" rel="nofollow noreferrer">SOS</a></p>\n'}, {'answer_id': 52872, 'author': 'David Lambert', 'author_id': 2133351, 'author_profile': 'https://Stackoverflow.com/users/2133351', 'pm_score': 1, 'selected': False, 'text': '<p>Smart Inspect from <a href="http://www.gurock.com/" rel="nofollow noreferrer">Gurock Software</a> has come in handy many times for me.  It is very easy to put into a .NET application and gives you extremely powerful control when analyzing log files.  It has log levels that allow you to turn off certain functionality except in certain cases so you don\'t lose performance.  </p>\n\n<p>They even have server software that your software can connect to to save logs when you do not have full access to the machines.  For example, you could have a server running at www.yourdomain.com.  Your software would have a configuration option to turn on debugging.  Smart Inspect would be configured to send the log data to your server (And optionally to a local file) so that you could get live logging no matter where the software is being run.</p>\n\n<p>Smart Inspect is very easy to configure and has many features that you can use to help.  I\'ve use it to debug high impact multi-threaded server applications on the fly without taking down the machines.  It has all the hooks to keep track of different processes, threads and machines.  </p>\n'}]
['https://Stackoverflow.com/questions/52808', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1365/']