1

When i use the Math library. like this.

 14-   int Result = 0;
 15-   Math.DivRem(1, 0, out Result);

The exception is marked in the line 15, but if i use my own Math Library, like this.

class MyMath
{
    public static decimal DivRem(int a, int b)
    {
        return a / b;
    }
}

and then call it.

 14-   int Result = 0;
 15-   MyMath.DivRem(1, 0);

The error is market inside my static DivRem in the line "return a / b;"

How can i achieve that?

ideas? thanks.

Fraga
  • 1,361
  • 2
  • 15
  • 47

3 Answers3

0

Put your own math library in a separate assembly where the calling assembly only references the compiled release version.

Jesse C. Slicer
  • 19,901
  • 3
  • 68
  • 87
0

Take a look at this question. The PDB seems to hold the debug information you would need to get those line numbers. Since I doubt there are PDB files for all the classes in the .NET framework, I think you are out of luck. I may be wrong, and they may be available, but at least you know what to look for now.

Community
  • 1
  • 1
Ocelot20
  • 10,510
  • 11
  • 55
  • 96
0

You can instruct the debugger to step through (rather than into) the method with an attribute; I suspect this will also cause it to show the Exception at the call site, but I'm not certain.

class MyMath
{
    [DebuggerStepThrough]
    public static decimal DivRem(int a, int b)
    {
        return a / b;
    }
}
Dan Bryant
  • 27,329
  • 4
  • 56
  • 102
  • This attribute is only for the debugger, so it behave like a framework method, but the exception is still inside. – Fraga Aug 09 '11 at 02:37