我使用Visual Studio 2015和一个用C#编写的ASP.NET网站。当我通过附加到w3wp进程并尝试添加监视来调试站点时,它通常适用于简单变量,但是一旦我尝试使用LINQ方法(不涉及lambda),例如简单地调用ToList()就可以了变量(当我知道变量上存在方法时),监视窗口返回错误消息,如:
statistics.ToList() error CS1061: 'IGrouping<<>f__AnonymousType8<int, string, string>, PerformanceMetricStatistic>' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'IGrouping<<>f__AnonymousType8<int, string, string>, PerformanceMetricStatistic>' could be found (are you missing a using directive or an assembly reference?)
或者,如果我尝试使用像Convert.ToDecimal(val)这样非常简单的东西,我会得到:
Convert.ToDecimal(aggregate.Average) error CS0103: The name 'Convert' does not exist in the current context
如果我在立即窗口中尝试相同的代码,我会得到同样的错误。