Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Extension methods not present when debugging
tlianza
#1 Posted : Sunday, March 18, 2012 11:22:12 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/14/2011(UTC)
Posts: 11
Location: Seattle, WA

Thanks: 1 times
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
#2 Posted : Monday, March 19, 2012 8:34:38 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,143

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
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?
jamezor
#3 Posted : Wednesday, May 23, 2012 9:36:08 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/9/2012(UTC)
Posts: 13
Location: Auckland

Was thanked: 1 time(s) in 1 post(s)
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.
Remco
#4 Posted : Wednesday, May 23, 2012 10:16:25 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,143

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
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.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.036 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download