<p>I'm debugging a production application that has a rash of empty catch blocks <em>sigh</em>:</p>

<pre><code>try {*SOME CODE*}
catch{}
</code></pre>

<p>Is there a way of seeing what the exception is when the debugger hits the catch in the IDE?</p>

[{'answer_id': 39827, 'author': 'Johnno Nolan', 'author_id': 1116, 'author_profile': 'https://Stackoverflow.com/users/1116', 'pm_score': 0, 'selected': False, 'text': "<p>Can't you just add an Exception at that point and inspect it?</p>\n"}, {'answer_id': 39831, 'author': 'Mike Schall', 'author_id': 4231, 'author_profile': 'https://Stackoverflow.com/users/4231', 'pm_score': 2, 'selected': False, 'text': '<p>In Visual Studio - Debug -> Exceptions -> Check the box by "Common Language Runtime Exceptions" in the Thrown Column</p>\n'}, {'answer_id': 39832, 'author': 'AdamB', 'author_id': 2176, 'author_profile': 'https://Stackoverflow.com/users/2176', 'pm_score': 5, 'selected': True, 'text': '<p>In VS, if you look in the Locals area of your IDE while inside the catch block, you will have something to the effect of $EXCEPTION which will have all of the information for the exception that was just caught.</p>\n'}, {'answer_id': 39833, 'author': 'John Rutherford', 'author_id': 3880, 'author_profile': 'https://Stackoverflow.com/users/3880', 'pm_score': 1, 'selected': False, 'text': '<p>You can write</p>\n\n<pre><code>catch (Exception ex) { }\n</code></pre>\n\n<p>Then when an exception is thrown and caught here, you can inspect ex.</p>\n'}, {'answer_id': 39834, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 1, 'selected': False, 'text': '<p>No it is impossible, because that code block says "I don\'t care about the exception".  You could do a global find and replace with the following code to see the exception.</p>\n\n<pre><code>catch {}\n</code></pre>\n\n<p>with the following</p>\n\n<pre><code>catch (Exception exc) {\n#IF DEBUG\n    object o = exc;\n#ENDIF\n}\n</code></pre>\n\n<p>What this will do is keep your current do nothing catch for Production code, but when running in DEBUG it will allow you to set break points on object o.</p>\n'}, {'answer_id': 39840, 'author': 'Chris Karcher', 'author_id': 2773, 'author_profile': 'https://Stackoverflow.com/users/2773', 'pm_score': 1, 'selected': False, 'text': "<p>If you're using Visual Studio, there's the option to break whenever an exception is thrown, regardless of whether it's unhandled or not.  When the exception is thrown, the exception helper (maybe only VS 2005 and later) will tell you what kind of exception it is.</p>\n\n<p>Hit <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>E</kbd> to bring up the exception options dialog and turn this on.</p>\n"}, {'answer_id': 39841, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 0, 'selected': False, 'text': "<p>@sectrean</p>\n\n<p>That doesn't work because the compiler ignores the Exception ex value if there is nothing using it.</p>\n"}]
['https://Stackoverflow.com/questions/39824', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4271/']