【发布时间】:2015-11-15 15:09:45
【问题描述】:
我正在尝试在 Visual Studio 2015 中调试 Linq 表达式。当我将它添加到监视窗口时,我在值列中收到以下错误。
field.DomainValues.Where(d => d.Active) 错误 CS1061: “List”不包含“Where”的定义,也没有 扩展方法“Where”接受类型的第一个参数 可以找到“列表”(您是否缺少 using 指令 还是程序集参考?)
当我尝试在即时窗口中执行时,我得到了同样的错误。
错误 CS1061:“列表”不包含 'Where' 并且没有扩展方法 'Where' 接受第一个参数 可以找到类型“列表”(您是否缺少使用 指令还是程序集引用?)
我认为基于这篇文章在 Visual STudio 2015 中添加了对此的支持 - http://blogs.msdn.com/b/visualstudioalm/archive/2014/11/12/support-for-debugging-lambda-expressions-with-visual-studio-2015.aspx
我发现这篇文章概述了一些限制,但没有一个适用于我的 x86 WPF 应用程序。 http://dotnetdeewane.blogspot.com/2015/03/support-for-debugging-lambda.html
- 我有一个 x86 .Net 4.5 WPF 应用程序
- 在我的输出窗口中,我看到 System.Core 已加载。
已加载 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
-
我的方法是静态的而不是异步的。我的班级顶部确实有 using System.Linq 语句。
using Infragistics.Windows.Editors; using Microsoft.Practices.ServiceLocation; using System; using System.Collections.Generic; using System.Linq; using System.Windows; public static ValueEditor SelectEditor(ColumnConfig config, TableInfo info, object value = null) { //do some stuff field.FilteredDomainValues = field.DomainValues.Where(d => d.Active).ToList(); //do some other stuff } 我没有使用动态类型
我还安装了 Visual Studio 2012 和 Visual Studio 2013。
我正在使用 Resharper。
还有什么我可以在 VS 选项中查看的内容?
【问题讨论】:
-
你的代码有用于 System.Linq 吗?
-
是的。我的代码编译并运行良好,它只是尝试使用看到此错误的新调试工具。我更新了我的帖子以显示这一点。
-
另一个人对 System.Linq 和 Resharper 扩展有另一个问题。见stackoverflow.com/questions/453451/…
-
你最终找到解决办法了吗?
-
将
Enumerable.Range放在App.xaml.cs上对我有用(.NET4.0 WPF)。
标签: c# .net visual-studio