Visual Studio 2010 Debugger Bug - by Paz013

Status : 

  External<br /><br />
		This item may be valid but belongs to an external system out of the direct control of this product team.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 776916 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/18/2013 10:37:02 AM
Access Restriction Public

Description

This is a really odd issue. We have a Try Catch with multiple Catch blocks. The first Catch block has no code, just a comment.

Try
  'Some Code
Catch ex As ThreadAbortException
  'Do Nothing
Catch ex As Exception
  HandleException(ex)
End Try

If an exception other than a ThreadAbortException is thrown, it is caught by the second Catch, as expected. However, when stepping through code in VS2010, the ex object is Nothing in that case. So far, we have found two ways to "fix" this issue.

Fix 1: Rename the first exception variable.

Try
  'Some Code
Catch tex As ThreadAbortException
  'Do Nothing
Catch ex As Exception
  HandleException(ex)
End Try
Fix 2: Add any line of code to the first Catch block.

Try
  'Some Code
Catch ex As ThreadAbortException
  Dim i As Integer = 1
Catch ex As Exception
  HandleException(ex)
End Try

Now, we know an empty catch block is bad practice. It is simply used to demonstrate the bug.  The bug is that ex should NOT be nothing in the very first case when stepping through the code and an exception other than ThreadAbortException is caught.
Sign in to post a comment.
Posted by Microsoft on 1/20/2013 at 11:50 PM
The product team itself no longer directly accepting feedback for Microsoft Visual Studio 2010 and earlier products. You can get support for issues with Visual Studio 2010 and earlier by visiting one of the resources in the link below:
<http://msdn.microsoft.com/en-us/vstudio/cc136615.aspx>

Sorry for the inconvenience.
Posted by Microsoft on 1/18/2013 at 10:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)