So, I have the following code:
static void Main(string[] args)
{
var test1 = GeneratedHelperSync();
var test2 = GeneratedHelperAsync().Result;
}
[System.Diagnostics.DebuggerNonUserCode]
static int GeneratedHelperSync()
{
return RealCode();
}
[System.Diagnostics.DebuggerNonUserCode]
async static Task<int> GeneratedHelperAsync()
{
// F11 steps in here!
return await Task.FromResult(RealCode());
}
private static int RealCode()
{
return 1;
}
And I F11 (step-into) through all the statements in Visual Studio 2013. I would expect that in both calls from Main() to step me into the "return 1" statement. However, in the second case, it steps me into the async function.
It seems that the compiler erases my DebuggerNonUserCode during the async code generation.
My question is, why is it doing that? Am I missing something?
As to why am I want this, I have some helper async functions that are automatically generated and I want to avoid stepping into them all the time.