Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any reason not to use Run-time Contract Checking with Code Contracts?

I've recently listened to Kevin Hazzard talk about Code Contracts in .Net Rocks show 570 (http://devjourney.com/community/dotnet-rocks-show-570-with-kevin-hazzard/). He mentions enabling Run-time Contract Checking as an option some people might choose to use while others might not.

Why would you not use Run-time Contract Checking for your Code Contracts? Is there a significant negative impact on performance? Other reasons?

If you disable this feature, how do you deal with preconditions in your methods at run-time?

like image 390
urig Avatar asked Feb 27 '23 14:02

urig


1 Answers

In some non-mission-critical applications, you may actually want to let the errors slide in a release build rather than throwing an error dialog in the face of the user. Small bugs that the end-user may never notice can cause your contract check to fail and harm user experience.

like image 130
mmx Avatar answered Apr 09 '23 12:04

mmx