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

Notification

Icon
Error

Code coverage missing when using dynamic keyword
gravypower
#1 Posted : Wednesday, April 30, 2014 8:05:29 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/14/2013(UTC)
Posts: 13
Location: Australia

Thanks: 5 times
Was thanked: 3 time(s) in 3 post(s)
Hello,

I am having an issue when using the dynamic keyword.

When I have test like this:

[Test]
public void DynamicKeyword()
{
dynamic o = new ExpandoObject();
o.Foo = "Bar";
Assert.That(o.Foo, Is.EqualTo("Bar"));
}

I lose code coverage in the file. I have looked around the forum and the only suggestion was to close and reopen the tab but that did not solve my issue.

I am able to get the code coverage by not using the dynamic keyword in line and casting it it at the end like this:

[Test]
public void DynamicCast()
{
var o = new ExpandoObject();
Assert.That(((dynamic)o).Foo, Is.EqualTo("Bar"));
}

Any thoughts as I would like to use the dynamic keyword like the first example and still keep my green/red dots on the left.

Aaron
gravypower
#2 Posted : Wednesday, April 30, 2014 8:20:07 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/14/2013(UTC)
Posts: 13
Location: Australia

Thanks: 5 times
Was thanked: 3 time(s) in 3 post(s)
Forgot, Using VS 2013 with NCrunch 2.7.0.5
Remco
#3 Posted : Wednesday, April 30, 2014 11:34:38 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

I've just thrown together a quick test on this side (.NET 4.5, VS2013), and the code coverage was still showing correctly. I suspect there may be more going on here.

Are you able to reproduce this issue in a simple throw-away solution? If so, would you mind submitting it via the contact form? https://www.ncrunch.net/Support/Contact.


Thanks!

Remco
1 user thanked Remco for this useful post.
gravypower on 4/30/2014(UTC)
gravypower
#4 Posted : Wednesday, April 30, 2014 11:47:42 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/14/2013(UTC)
Posts: 13
Location: Australia

Thanks: 5 times
Was thanked: 3 time(s) in 3 post(s)
I will put something together this evening (morning your time)

Aaron
1 user thanked gravypower for this useful post.
Remco on 4/30/2014(UTC)
gravypower
#5 Posted : Wednesday, April 30, 2014 12:59:27 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/14/2013(UTC)
Posts: 13
Location: Australia

Thanks: 5 times
Was thanked: 3 time(s) in 3 post(s)
Worked out the issue. It was the Roslyn CTP.

I am working with it in the project I originally found the issue, and when I created a simple project with the above test I had the same problem. This got me thinking that it could be Roslyn as I assume you did not have it installed.

Removed it and the code coverage returned :)

Did you still want me to open a support ticket? Would love to see it work with Roslyn but as its a CPT I am not too concerned.

Aaron


Remco
#6 Posted : Wednesday, April 30, 2014 1:26:21 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Interesting ... I wonder then if Roslyn is neglecting to emit debug information for methods using dynamic. Are you able to step into the code at all? If not, this could be something that should be raised with Microsoft.

NCrunch will support Roslyn - although any new features that rely on it won't really be useful until Roslyn is out of it's CTP state. Integrating with products while they're in CTP tends to be quite expensive, as they very often change before hitting RTM and the documentation is often fairly minimal. I'll note this down for some experimentation later when Roslyn starts to become a bigger thing for NCrunch. Thanks for making me aware of it.
1 user thanked Remco for this useful post.
gravypower on 4/30/2014(UTC)
gravypower
#7 Posted : Wednesday, April 30, 2014 1:55:52 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/14/2013(UTC)
Posts: 13
Location: Australia

Thanks: 5 times
Was thanked: 3 time(s) in 3 post(s)
Hey,

FYI: I am able to step trough the code.

Aaron
1 user thanked gravypower for this useful post.
Remco on 4/30/2014(UTC)
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.039 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download