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 a bit more about how Gnutella and other P2P networks function, I
I've been reading about singletons in ASP.Net and I've seen various implementations and suggestions.
After reading some excellent posts about the difference between AppDomain.UnhandledException and Application.DispatcherUnhandledException, it appears
After reading quite few articles on deployment, i am bit confused about the procedure.
I'm learning about software engineering and design right now, and after reading some books
Recently I have been reading about lotto wheeling and combination generating. I thought I'd
After reading some questions/answers about activity and process lifecycle. I suppose I understand the
I have about a dozen repositories that on the file system are 1 GB
After reading some of the SCJP certification last night, I got thinking about switch
After reading about semaphores I tried this test code in which I create two

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.