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

Notification

Icon
Error

Compiler constant being ignored in .net core project
cbondeson
#1 Posted : Thursday, June 15, 2017 2:00:33 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 13
Location: United States of America

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
I am using ncrunch on a .net core project and use "#if !NCRUNCH" in the code but the code is still being run. I am using ncrunch version 3.7.0.7.
Remco
#2 Posted : Thursday, June 15, 2017 12:02:51 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)
Hi, thanks for sharing this problem.

I can reproduce this in v3.9 also. It looks like the mechanism for introducing this constant is somehow failing under a CPS build system.

I've noted this down to be fixed.

To work around this, I suggest changing your project file to introduce a build condition around a manually declared build constant, for example:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants Condition="'$(NCrunch)' == '1'">TRACE;DEBUG;NETCOREAPP1_1;NCRUNCH</DefineConstants>
</PropertyGroup>
cbondeson
#3 Posted : Thursday, June 15, 2017 2:14:55 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 13
Location: United States of America

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
The work around seemed to work, thank you. Please let me know when this is fixed.
Remco
#4 Posted : Friday, June 16, 2017 4:04:40 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)
1 user thanked Remco for this useful post.
cbondeson on 6/16/2017(UTC)
cbondeson
#5 Posted : Friday, June 16, 2017 3:22:01 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 13
Location: United States of America

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Looks like the new build worked with this error. Thanks.
1 user thanked cbondeson for this useful post.
Remco on 6/16/2017(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.036 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download