Exception Stack Trace Missing Items

Viewed 2208

Sometimes, when I get a crash report from an application, a method is missing in the stack trace. I don't think the following code will reproduce it, but let's say, for reference we have this:

using System.IO;
using System;
using System.Collections.Generic;

class Program
{
    static List<int> stuff;
    static void Main()
    {
        stuff = new List<int>();
        int result = Foo();
    }

    static int Foo(){
        return Bar(5);
    }

    static int Bar(int value){
        return stuff[value];
    }
}

When System.Collections.Generic.List'1.get_Item(Int32 index) throws a System.ArgumentOutOfRangeException, the stack trace is missing Foo(). For the sake of this argument, the compiler did not optimize the code since the de-compiler shows that it was not in-lined. Does anyone know what would cause this (other than compiler in-lining)?

Edit: To clarify, the application is not in debug mode when the Stack Trace is made.

2 Answers
Related