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

Notification

Icon
Error

Skip unnecessary costly build steps (code analysis / code contracts static checker) when possible
Strilanc
#1 Posted : Tuesday, April 3, 2012 4:25:59 PM(UTC)
Rank: Member

Groups: Registered
Joined: 4/3/2012(UTC)
Posts: 17

Thanks: 1 times
I really like NCrunch but if I use it in conjunction with code analysis (run automatically on build) or static verification of code contracts it takes far FAR too long to run tests. This is frustrating because the output of code analysis and static verification of code contracts has no effect on the outcomes of unit tests.

Code contracts and code analysis are likely to be widespread, so NCrunch interacting poorly with them is likely to be a big problem in practice. Users will be annoyed by having to toggle between good analysis when building and fast iteration while developing.

I suggest automatically detecting when code contracts and code analysis are present and skipping their expensive build steps when possible/appropriate.
Remco
#2 Posted : Tuesday, April 3, 2012 9:15:56 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
This makes sense. NCrunch will need to put out a warning letting people know that it won't be doing any code contracts checking though. Meanwhile, if you want to work around this, there is a blog post from someone that has disabled these build steps for their NCrunch - you may be able to make use of this to shut the build steps off manually until I can introduce a feature that will do this: http://yfrog.com/z/0t4chp
Remco
#3 Posted : Sunday, May 20, 2012 11:44:24 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
For anyone interested, the recently released v1.39b of NCrunch includes a project-level configuration setting that can disable code contracts checking for NCrunch builds. By default, code contracts checking is now disabled.
jamesmanning
#4 Posted : Thursday, May 24, 2012 4:50:00 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/7/2012(UTC)
Posts: 17
Location: Raleigh, NC

Was thanked: 1 time(s) in 1 post(s)
I just got 'bit' by this - I can understand skipping the static contract checking, but I don't understand not supporting the runtime checking (especially when my project has CONTRACTS_FULL defined :). As it stands, NCrunch couldn't run my tests, just throwing up the same type of failure dialog from the contract checking when the assembly wasn't built with runtime contract checking turned on.

Hopefully the intent was just to build faster by skipping the static checking (which is indeed time consuming). I don't see any gain to disabling the runtime checking, since either the project doesn't use it (so it's no overhead) or it does (in which case, disabling it breaks it :)

The particular project settings I'm referring to:


  • CodeContractsEnableRuntimeChecking = True (I want the runtime checking)
  • CodeContractsRunCodeAnalysis = False (I don't want the static checking - you can keep disabling that for the NCrunch build, that makes sense)


Thankfully I ran across this thread, but especially as an existing NCrunch user, it was painful to have it start failing in a non-obvious way like this. :)

If you feel disabling the runtime is still advantageous, can the static checking and runtime checking be split into 2 different flags, with the runtime one either defaulting to 'true' or at least defaulting to 'true' if the project has CodeContractsEnableRuntimeChecking = True? :)

Thanks!
Remco
#5 Posted : Thursday, May 24, 2012 10:37:25 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi James,

Sorry - I didn't realise that disabling this option in such a way would have this effect on your tests. Based on what you've described, having two settings does make sense. I'll see what I can do.


Cheers,

Remco
Remco
#6 Posted : Tuesday, June 19, 2012 4:46:20 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
1.40b (just released) includes a split between the two code contracts settings. Static contract checking is now disabled by default, where dynamic contract checking is enabled by default. Hopefully this should make the behaviour of code contracts inside NCrunch more intuitive without sacrificing performance.
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.043 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download