Esempio n. 1
0
    public static int Main()
    {
        int ret = 100;
        VInline vi = new VInline(1);
        int ival = 2;
        try
        {
            ival = vi.Accumulate(ival);  //this call should throw a divide by zero exception
        }
        catch (DivideByZeroException e)
        {
            Console.WriteLine("exeption stack trace: " + e.StackTrace.ToString());  //display the stack trace
            if (e.StackTrace.ToString().Contains("Accumulate"))
            {
                Console.WriteLine("Fail, method Accumulate NOT inlined.");
                ret = 666;
            }
            else
            {
                Console.WriteLine("Pass, method Accumulate inlined.");
            }
        }

        return ret;
    }
Esempio n. 2
0
    public static int Main()
    {
        int     ret  = 100;
        VInline vi   = new VInline(1);
        int     ival = 2;

        try
        {
            ival = vi.Accumulate(ival);  //this call should throw a divide by zero exception
        }
        catch (DivideByZeroException e)
        {
            Console.WriteLine("exeption stack trace: " + e.StackTrace.ToString());  //display the stack trace
            if (e.StackTrace.ToString().Contains("Accumulate"))
            {
                Console.WriteLine("Fail, method Accumulate NOT inlined.");
                ret = 666;
            }
            else
            {
                Console.WriteLine("Pass, method Accumulate inlined.");
            }
        }

        return(ret);
    }