There's a first time for everything. Today, I got to use the attribute that prevents a method from being inlined.

There's a good post, including a bit of a warning, on the MSDN forums regarding the issue and solution.

In my case, I was looking at the call stack to get the current method, so that I could pull some metadata attributes off of the method. Worked well until it hit the build server. Then the unit tests started failing. Adding the [MethodImpl(MethodImplOptions.NoInlining)] attribute did the trick.

If you're going to try this, I'd recommend the article, since it discusses some potential issues with this approach.

Cheers!