Cannot catch DivideByZeroException RRS feed

  • Question

  • In new WF 4.0 even I cannot catch DivideByZeroException when I using A/B expression in assign shape. I just got the infinity result. 

    Or I must check the B equals zero and throw this exception manual?

    Any ideas?


    Thursday, April 22, 2010 12:48 PM


  • Hi,

    This is a behavior of Visual Basic (which is used for expressions in WF, such as the expression in an Assign activity). The following topic covers VB arithmetic operations and about halfway down is a section on doubles and DivideByZeroException.


    What is your data type for the result? If it is integers, you could use integer division (the backslash operator) which does throw that exception if the divisor is zero.

    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm




    • Proposed as answer by Andrew_Zhu Thursday, April 29, 2010 6:48 AM
    • Marked as answer by upzone Friday, May 21, 2010 3:24 AM
    Thursday, April 22, 2010 3:03 PM