Exceptions not being caught

Posted by Thomas Freudenberg on Stack Overflow See other posts from Stack Overflow or by Thomas Freudenberg
Published on 2010-03-08T07:42:13Z Indexed on 2010/03/08 7:51 UTC
Read the original article Hit count: 238

Filed under:
|

We have following code:

try {
    // some code throwing MyException
} catch (MyException ex) {
    // [1]
    // no (re)throw here
} catch (Exception ex) {
    if (ex is MyException) {
        // [2]
    }
}

If we run the code without a debugger attached, everything runs fine. However, IF we debug the code, we don't get to point [1] but [2]. As far as I understand the language specification this should not be possible.

Even weirder, this code used run fine even while debugging. The strange behavior started only a few days ago.

© Stack Overflow or respective owner

Related posts about c#

Related posts about exception