Look at the following program.
The comments show the order of execution when I use Visual Studio 2008, and start, and step through the program only hitting the F11 (Step Into) debugging hotkey. The first column is what I actually experience now, the second column is what I expected to happen.
Note that the method in the class marked with the DebuggerNonUserCode attribute is stepped into, whereas the one with DebuggerStepThrough isn't. I expected the debugger to step over both of these. This did not happen before. I've tagged a lot of my classes with this attribute, since I don't want to wade through all that noise when debugging new features in my class library, but now the debugger walks right into them as though the attribute isn't there.
Anyone experienced this? Have I messed up an option somewhere in Visual Studio?
using System;
using System.Diagnostics;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{ // 1 // 1
new C1().Test(); // 2, 5 // 2
new C2().Test(); // 6 // 3
} // 7 // 4
}
[DebuggerNonUserCode]
public class C1
{
[DebuggerNonUserCode]
public void Test()
{ // 3
} // 4
}
[DebuggerStepThrough]
public class C2
{
[DebuggerStepThrough]
public void Test()
{
}
}
}