I was quite excited to test the lambda expression evaluation in Watch/Immediate window of VS2015, unfortunately I can't get this feature working.
I was testing this on few ASP.NET project(using .NET 4.6.1), but no matter what expression I type into Watch window, the message is still the same: Expression cannot contain lambda expressions
. Colleague of mine is happily using this tool on the same projects since we received VS2015.
This is one from all lambda's:
private static void LinqTest()
{
List<int> list = new List<int> { 1, 2, 3, 4, 5, 6 };
int lambda = list.First<int>(p => p == 2);
}
This code returns 2 as expected but in Watch and Immediate window list.First<int>(p => p == 2)
yields Expression cannot contain lambda expressions
error.
I have been looking for some tips all around the internet, but I have never seen any pre-requirements, nor restrictions of this feature, so I was hoping someone can give me useful hint, which will avoid me from reinstalling Visual Studio completely (as I currently don't see no other option).
I am running Visual Studio 2015 Professional, Version 4.6.01038 on Windows 10.