I am trying to debug a Linq expression in Visual Studio 2015. When I add it to the watch window I get the following error in the Value column.
field.DomainValues.Where(d => d.Active) error CS1061: 'List' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)
When I try to execute in the Immediate Window I get the same error.
error CS1061: 'List' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)
I thought that support was added for this in Visual STudio 2015 based on this article - http://blogs.msdn.com/b/visualstudioalm/archive/2014/11/12/support-for-debugging-lambda-expressions-with-visual-studio-2015.aspx
I found this article that outlines some limitations, but none apply to my x86 WPF application. http://dotnetdeewane.blogspot.com/2015/03/support-for-debugging-lambda.html
Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
My method is static and not async. I do have the using System.Linq statement at the top of my class.
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
}
I'm not using dynamic types
I have Visual Studio 2012 and Visual Studio 2013 also installed.
I am using Resharper.
Anything else I could check in VS options?
You can use the debugger windows to see whether each item meets the specified condition, and you can step through the code in IsEven . The predicate in this example is fairly simple. However, if you have a more difficult predicate you have to debug, this technique can be very useful.
It's available from Debug | Windows | Watch | Watch 1 or Ctrl + Alt + W + 1. There are 4 watch windows in Visual Studio, which you can use in different contexts (Watch 1, Watch 2, etc.). Any expression can be entered into the watch window.
On the Debug menu, choose Windows > Immediate.
Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language. Traditionally, queries against data are expressed as simple strings without type checking at compile time or IntelliSense support.
The key is to ensure that System.Core.dll is loaded. One easy way to do this is to have the following at the top of the file you're debugging in:
#if DEBUG
using System.Diagnostics;
#endif
I had the same problem and i fixed it making a call to Enumerable.Range in the code before checking the lambda expression in the watching window
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With