When I'm debugging a test in ncrunch, if I try to inspect a System.Linq.IQueryable and then call ToList() on it in the QuickWatch tool I get:
'System.Linq.IQueryable<MYTYPE>' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Linq.IQueryable<MYTYPE>' could be found (are you missing a using directive or an assembly reference?)
Certainly Linq provides all of these as extension methods, and when I debug this by attaching Visual Studio to nUnit it works as expected. Is there something special I need to do for nCrunch?
Remco NCrunch Developer
#1501
19 Mar 2012 08:34 UTC
Hi,
This is interesting. NCrunch does do some wizardry in order to build your test/debug environment inside its workspace, so I'm wondering if something here may be messing up the resolution in the debugger. Does the ToList() extension method work if you try it inside the immediate window?
This is interesting. NCrunch does do some wizardry in order to build your test/debug environment inside its workspace, so I'm wondering if something here may be messing up the resolution in the debugger. Does the ToList() extension method work if you try it inside the immediate window?
I'm getting a similar issue too. In the immediate window, the following occurs:
> myEnumerable.ToList()
'System.Collections.Generic.IEnumerable<T>' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Collections.Generic.IEnumerable<T>' could be found (are you missing a using directive or an assembly reference?)
I have 'using System.Linq' in the file in question.
When I reference the extension method directly as follows it works fine:
> System.Linq.Enumerable.ToList(myEnumerable)
Count = 1
[0]: ...
When debugging through the ReSharper Unit Test runner it generally works fine.
> myEnumerable.ToList()
'System.Collections.Generic.IEnumerable<T>' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Collections.Generic.IEnumerable<T>' could be found (are you missing a using directive or an assembly reference?)
I have 'using System.Linq' in the file in question.
When I reference the extension method directly as follows it works fine:
> System.Linq.Enumerable.ToList(myEnumerable)
Count = 1
[0]: ...
When debugging through the ReSharper Unit Test runner it generally works fine.
Remco NCrunch Developer
#1957
23 May 2012 10:16 UTC
Thanks. I've since done some more looking into this issue, and I can confirm that it is caused by the way that NCrunch is handling its namespaces when processing debug information during instrumentation. The fix is very difficult but I do hope to solve this problem eventually. Generally the workaround is to specify the full namespace of anything you access in the debugger - though I've yet to find a way to make this work for extension methods.
Post a reply
Log in to reply.