locked
Continuing after first chance exception. RRS feed

  • Question

  • I have an app that uses the IBM WebSphere MQ amqmdnet.dll from their client install. When debugging, I get a first chance exception of type 'System.TypeInitializationException' (The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.) which is fine, I can disable them but why can I not continue on by simply pressing F5, the app exits if I do? If its not handled internally within the dll, how does it not fail when not in debugging?

    Thanks.

    Saturday, February 14, 2015 12:33 AM

Answers

  • Hi Ritmo2k,

    From your description, I think the main issue is IBM WebSphere MQ amqmdnet.dll 

    After take a look at the following thread, end result is IBM doesn't provide a supported configuration smaller than the full client install. So the exception is expected. Note  reply fromT.Rob's suggestions.

    Type initializer for IBM.WMQ.MQQueueManager throws an exception

    >> I can disable them but why can I not continue on by simply pressing F5, the app exits if I do? If its not handled internally within the dll, how does it not fail when not in debugging?

    Here is the reply from Lifeng Lu - MSFT

    The reason is the exception event handler is disabled, when you run it under debugger. That is by-design to help debugger to stop on unexpected exceptions. With the exception event handler, you would catch all exceptions, so you would miss a bug, if your code causes, for example, a NullReference exception.

    Of course, in your scenario, the exception is expected. Unfortunately, there is no way to disable this behavior (which is done in the framework code in your application.) 

    You can try to start your application in non-debug mode, (start it out of the Visual Studio), and attach the debugger to your application after this.  That will make the application to think there is no debugger attached when it starts, so your event handler could work.

    Please also refer to How to continue execution after an exception? for more detailed information. Thanks.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Sunday, February 15, 2015 5:22 AM
    • Marked as answer by Ritmo2k Monday, February 16, 2015 6:31 PM
    Sunday, February 15, 2015 5:21 AM

All replies

  • Hi Ritmo2k,

    From your description, I think the main issue is IBM WebSphere MQ amqmdnet.dll 

    After take a look at the following thread, end result is IBM doesn't provide a supported configuration smaller than the full client install. So the exception is expected. Note  reply fromT.Rob's suggestions.

    Type initializer for IBM.WMQ.MQQueueManager throws an exception

    >> I can disable them but why can I not continue on by simply pressing F5, the app exits if I do? If its not handled internally within the dll, how does it not fail when not in debugging?

    Here is the reply from Lifeng Lu - MSFT

    The reason is the exception event handler is disabled, when you run it under debugger. That is by-design to help debugger to stop on unexpected exceptions. With the exception event handler, you would catch all exceptions, so you would miss a bug, if your code causes, for example, a NullReference exception.

    Of course, in your scenario, the exception is expected. Unfortunately, there is no way to disable this behavior (which is done in the framework code in your application.) 

    You can try to start your application in non-debug mode, (start it out of the Visual Studio), and attach the debugger to your application after this.  That will make the application to think there is no debugger attached when it starts, so your event handler could work.

    Please also refer to How to continue execution after an exception? for more detailed information. Thanks.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Sunday, February 15, 2015 5:22 AM
    • Marked as answer by Ritmo2k Monday, February 16, 2015 6:31 PM
    Sunday, February 15, 2015 5:21 AM
  • Much appreciated Kristin, that clarifies everything and attaching to the process after starting it without debugging worked fine.

    Thanks!

    Monday, February 16, 2015 6:32 PM