When I am debugging an async method in visual studio and I am trying to see the value of a local variable, I get the error message: "error CS0103: The name 'x' does not exist in the current context".
I am using aspect-injector version 1.0.1.
I am primarily having this problem in web api controllers, but I can reproduce the problem in the following console app:
class Program
{
private static void TestMethod() => Task.Run(() =>
{
var x = 1;
Console.WriteLine(x);
});
private static void AsyncTestMethod() => Task.Run(async () =>
{
var x = 2;
Console.WriteLine(x);
});
static void Main(string[] args)
{
TestMethod();
AsyncTestMethod();
Console.ReadLine();
}
}
If I put a breakpoint in Console.WriteLine(x) in TestMethod, I can see the value of x in the debugger.
But when I do the same thing in AsyncTestMethod, I get the error message, and I cannot see the value of x.
The only difference between TestMethod and AsyncTestMethod is that AsyncTestMethod is running the lambda expression async.
I hope that there is a solution to this problem - It has been driving me crazy.
When I am debugging an async method in visual studio and I am trying to see the value of a local variable, I get the error message: "error CS0103: The name 'x' does not exist in the current context". I am using aspect-injector version 1.0.1. I am primarily having this problem in web api controllers, but I can reproduce the problem in the following console app:
If I put a breakpoint in Console.WriteLine(x) in TestMethod, I can see the value of x in the debugger. But when I do the same thing in AsyncTestMethod, I get the error message, and I cannot see the value of x. The only difference between TestMethod and AsyncTestMethod is that AsyncTestMethod is running the lambda expression async. I hope that there is a solution to this problem - It has been driving me crazy.