Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 804717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:57:49+00:00 2026-05-14T23:57:49+00:00

After reading about the System.Diagnostics.Contracts.Contract static class that has been influenced by the awesomeness

  • 0

After reading about the System.Diagnostics.Contracts.Contract static class that has been influenced by the awesomeness of Spec# I was thrilled and immediately started peppering my code with calls to Contract.Requires() and Contract.Ensures().

I guess it’s just because my code is so super-awesome and bug-free that checking that those calls actually did something just didn’t come up until recently. A bug slipped through and I came to the realization that these calls do not do anything! I would have thought that they at least throw an exception when the condition is violated but no such luck.

Am I missing something? Does anyone know what the heck is the point?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:57:49+00:00Added an answer on May 14, 2026 at 11:57 pm

    From the Contract Class page at MSDN:

    You must use a binary rewriter to
    insert run-time enforcement of
    contracts. Otherwise, contracts such
    as the Contract.Ensures method can
    only be tested statically and will not
    throw exceptions during run time if a
    contract is violated. You can download
    the binary rewriter CCRewrite from
    Code Contracts on the MSDN DevLabs Web
    site. CCRewrite comes with a Visual
    Studio add-in that enables you to
    activate run-time contract enforcement
    from the project Properties page. The
    binary rewriter and the Visual Studio
    add-in do not ship with Visual Studio
    2010 or the Windows SDK.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading about the problem of passing empty std::string objects between DLLs and EXEs,
After reading an article about the subject from O'Reilly , I wanted to ask
After reading a description about swapping pointer addresses on Stackoverflow, I have a question
After reading an article about fonts, i tried the code and i am getting
After reading some articles about XSS I have incorporated HTMLPurifier into my zend framework
Im skinning a progressBar in Flex, and after reading a bit about it, I
After reading a bit more about how Gnutella and other P2P networks function, I
After reading this discussion and this discussion about using CrashRpt to generate a crash
After reading Practical Common Lisp I finally understood what the big deal about macros
After reading http://www.w3schools.com/tags/tag_noscript.asp confused about onclick event on noscript tag. Anybody knows the purpose?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.