Artihmetic Overflow when calling STArea() on geography instance RRS feed

  • Question

  • Hello,

    I have a strange behavior in my code execution. I'm getting features from my SQL Server database and performing STArea() calls on each retrieved instance.

    Every instance is valid and not self intersecting.

    Then sometimes, I get an "Arithmetic Overflow" exception. If I call again the same method STArea(), it works. 

    double area= 0d;
      area = p_NativeGeography.STArea().Value;					}
    catch (System.OverflowException)
      // Sometimes getting "Arithmetic Overfow."
      // recall the same STArea()
      area = p_NativeGeography.STArea().Value;
      // .. never crashes
      // Doing stuff here...

    Stack trace is 

       at System.Data.SqlTypes.SqlDouble..ctor(Double value)
       at System.Data.SqlTypes.SqlDouble.op_Implicit(Double x)
       at Microsoft.SqlServer.Types.SqlGeography.STArea()

    Do you have any idea of what's going on ? SQL CLR 2008 Types are installed on computer running the program.

    Thank you

    Wednesday, April 3, 2013 10:15 AM