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 CodeCatch ex As ThreadAbortException 'Do NothingCatch ex As Exception HandleException(ex)End TryIf 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 CodeCatch tex As ThreadAbortException 'Do NothingCatch ex As Exception HandleException(ex)End TryFix 2: Add any line of code to the first Catch block.Try 'Some CodeCatch ex As ThreadAbortException Dim i As Integer = 1Catch ex As Exception HandleException(ex)End TryNow, 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.
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Operating System Language