Share on Facebook Tweet on Twitter Share on LinkedIn Share by email
Code Contracts for .NET Release Notes

Release 1.7.11202.10 (December 3, 2014)

  • Fixed a crash introduced in the previous version, when inferred object invariants are read from the cache

Release 1.7.11106.10 (November 7, 2014)

  • Many improvements to the static checker
  • Smarter error messages which try to understand what's wrong in your code
  • Added Inference of postconditions for autoproperties
  • Inference of object invariants 'forward' for readonly fields (and fields that are only assigned in constructor)
  • new version of ccrefgen which should use less memory
  • Fixed many precision bugs in the static checker

 

Release 1.6.60505.10 (May 10, 2014)

  • 'Only Public Surface Contracts' setting now erases all Assume and Assert Contracts in all methods.
  • Added support for VS2013
  • Performance improvements to cccheck.exe.
  • Bug fixes for cccheck.exe.
  • Added suggestion of readonly fields to cccheck. (Use with discretion, it may produce too many warnings.)
  • Added more contracts for framework libraries.

Release 1.5.60911.10 (Sep 11, 2013)

  • Fixes installation glitch on machines without VS2013.
  • Fixes a stack-overflow problem in cccheck.exe
  • Fixes problems in handling old values in cccheck.exe
  • When "Fail build on warnings" is enabled in cccheck.exe, the code issues are output as errors rather than warnings.
  • Warning prioritization tweaked.
  • Avoid generating dead locals that cause CA1804 warnings.

Release 1.5.60813.10 (Aug 13, 2013)

  • Contract.Result<T>() valid in Task<T> returning methods. Corresponds to Contract.Result<Task<T>>().Result
  • Revert to storing localdb .mdf cache files in a central place (AppData/Local/CodeContracts)
  • cccheck.exe no longer return non-zero return code (and fails build if not run in background) when xml regression fails, unless -failOnWarnings is on.
  • Fix type parameter issue causing bad overload selection
  • Better handling of legacy requires in static analysis
  • Updated doc on static checking of invariants to clarify default struct constructor behavior
  • When using Abbreviators and Validators, properly introduce local variables when address-of operator is applied to non-addressable expressions due to generic instantiations.
  • Make sure to preserve line-feed/carriage-return pair in xml doc output
  • Fixed source text in xml docs on exceptional ensures
  • Support for VS2013 preview added.
  • Contract source text in asserts/assumes within closures and iterators now available in runtime message.

 

Release 1.5.60502.11 (May 2, 2013)

  • Build script fix to not warn about missing contract reference assembly for C/C++ interop projects
  • Fix to VB constructor extraction
  • Properly handle generic methods in interface contracts when called from contracts.
  • Fix handling of unbox in non-null analysis (avoid a null deref)
  • Better handling of nullable and boxing constraints in static checker
  • Fix to show setter contracts on F12 (goto metadata)
  • More robust checking in implementation of Editor Extension
  • Reduced memory consumption and startup time of ccrewrite
  • Handle MEF Import attributes in non-null analysis
  • Preserve cross-assembly access to volatile fields in rewriter.
  • Fix a bug in the contract extractor when closures were present in a constructor.
  • Fix bug in rewriter when abbreviator method had static generic closure method.
  • Support async on pre 4.5 versions of the framework.

 

Release 1.5.60409.11 (Apr 9, 2013)

  • Bumped minor version due to new support for Roslyn generated assemblies.
  • More contracts under System.Reflection. Avoids warnings from static checker when using Linq Expressions with properties.
  • More fixes for async decompilation.
  • Relax handling of struct constants in contracts (e.g. default(DateTime))
  • Actually checked-in the fix to ccdocgen when interop types are present.
  • Avoid running Contract tools during project loading (avoids warnings in error list during project loading)
  • Fix issues in static checker w.r.t Enum checking
  • Fix for extracting contracts in the presence of XML literals in optimized VB code
  • Fix rewriter issue manifesting in missing type constraint

 

Release 1.4.60317.12 (Mar 15, 2013)

  • Running CCCheck.exe in the background in Visual Studio 2012 integration fixed by not depending on VS2010 components.
  • Another Async decompilation fix that manifested in NotImplemented exception in ccrewrite.
  • More graduated warning level for static checker
  • More enum warnings in static checker
  • Fix to ccdocgen when interop types are present.
  • [DebuggerBrowsable(Never)] attribute added to $evaluatingInvariant$ field generated by the rewriter so they don't show up during debugging.
  • CCCheck caching now prints which sql server it connects to. It will also fail over to localDb/sqlexpress if the connection fails to the given server
  • Fixed a number of contracts in mscorlib, including various CopyTo and BinarySearch

Release 1.4.60301.15 (Mar 1, 2013)

  • Fixed crashes in ccdocgen and ccrewrite.
  • More async pdb fixes
  • C# ?? operator now supported in contracts
  • The tools now show up as extensions in VS2010 and VS2012 and in VS2012 you will get update notifications from now on.

Release 1.4.60221.11 (Feb 22, 2013)

  • Fixed debugging info in async/iterator methods so debugger can display locals
  • Fixed build problems when targeting portable libraries for Win8 and Phone8
  • New static checker option to warn about missing Requires for externally visible methods
  • Other miscellaneous bug fixes.

Release 1.4.51019.0 (October 19, 2012)

  • Fixed more problems with the task manager in VS2012.
  • Fixed a bug in CCDoc.
  • Other miscellaneous bug fixes.

Release 1.4.50910.0 (September 10, 2012)

  • Fixes the task manager so it runs correctly in VS2012: static checker now runs in the background, squigglies are drawn, and contract suggestions appear in the Error List.
  • Updated the installer so that "devenv /setup" no longer needs to be run manually after installation. It is now done automatically as part of the installation. (Which makes the installation take a *lot* longer...)
  • Fixes several bugs in CCDoc.

Release 1.4.50813.1 (August 13, 2012)

  • Bug fixes (everywhere!).
  • Performance improvements (static checker).
  • Precision improvements (static checker).
  • Fixes to installer and build files.

Release 1.4.50327.0 (March 27, 2012)

  • VS2012 support! (But you need to run "devenv /setup" manually after installation!)
  • Bug fixes.

Release 1.4.50126.1 (January 26, 2012)

  • Added contract assemblies for Silverlight 5.

Release 1.4.50111.1 (January 11, 2012)

  • Fix a bug that caused Silverlight applications to not be executable when rewritten.
  • Fix documentation bug that had bad cross-references.

Release 1.4.412128.0 (December 28, 2011)

  • The static checker is now available in all editions of Visual Studio (except for Express), so there is now just one edition of Code Contracts.
  • Many more contract assemblies and many more contracts in existing contract assemblies.
  • Inference/suggestion of contracts:
    • Preconditions
    • Postconditions
    • Object invariants (for readonly fields)
  • Inferred contracts are persisted in the cache.
  • Many bug fixes, including many that were causing out-of-memory errors.

Release 1.4.40602.0 (June 2, 2011)

  • Rewriter
    • Fix so that other rewriters (Cecil in particular) that do not name injected local variables do not bother our tools.
  • Static Checker
    • Warnings for redundant preconditions.
    • A new precondition suggestion algorithm that should be more precise the previous one. (The suggestions are on by default.)
    • Many new contracts for framework methods.

Release 1.4.40314.1 (March 14, 2011 Pi Day!)

  • Bug Fixes
    • MsBuild Issues
      • Fixed quoting of command-line arguments.
      • Made .rsp file names project specific (should help if multiple projects build in the same directory)
      • Moved static checker helper files to obj tree (from bin)
    • Rewriter
      • Fixed CodeAnalysis warnings CA1047, CA1051, and CA2204 caused by rewriter-generated code
    • Static Checker
      • Fixed cache file name issue. Project-specific cache file name is now generated automatically. Command-line provided paths are supported too.

Release 1.4.40307.0 (March 7, 2011)

  • New Features
    • All tools now support response files so that their command-line arguments are passed in a file. This should fix problems people reported with too-long command-lines. It is integrated into the msbuild targets.
    • Runtime Checking
      • A new option, Skip Quantifiers, will not check any contracts that contain calls to Contract.ForAll or Contract.Exists. This can make a big performance difference.
      • Invariants of a base class are not checked until the construction of a subtype instance is completed.
    • Static Checking
      • Added a warning filtering (low/medium/hi).
      • Added support for Enum. Understanding of Enum.IsDefined(...). New check ensuring that on enum write the value is in the enum range (if the enum type is not marked with [Flags]).
      • Added masking for properties in object invariants.
      • Added a human-readable suppress mesage string only for postconditions.
      • Report unused "SuppressMessage" annotations at the method level.
      • Modified the report of the statistics of the analysis: now also report how many messages have been filters (either because of the warning filtering or because of the attribute).
      • When the static checker crashes, it reports the number and the name of the method under analysis to simplify bug reporting.
      • The database with the cache information now has the name of the assembly under analysis. A command-line option allows the name to be customized.
      • Container analysis is always on, so the checkbox has been removed from the UI.
  • Bug Fixes
    • Fixed the crash in LinearEqualities reported in many forum posts.
    • Fixed a memory leak.
    • Got rid of the "On demand fixpoint computation time out" message.
    • Made container analysis more stable and precise.
    • Hashing was not consider the [Pure] attribute and quantifiers (Contract.ForAll/Contract.Exists).
  • Contracts:
    • Fixed Linq contrcts, better handling of the array analysis for them.
    • Added/improved contracts for System.Numerics, System.Random, System.Math, System.String, and System.Threading.Task.

Release 1.4.31130.0 (November 30, 2010)

  • Lots of bug fixes, especially within the static checker. The caching should be much faster now.
  • The static checker now emits a warning (and not an error) when contradictory preconditions and invariants are found.
  • Added more contracts for methods in the .NET Framework.
  • All of the tools now take a -resolvedPath option which is used to point directly to referenced assemblies. This should cut down on the the problem many users have had where the wrong version of a referenced assembly is loaded. (Users should not have to specify the option, it is generated by the build integration.)
  • The installer now requires .NET v3.5.
  • Container analysis is now on by default in the static checker (and has been removed from the UI).
  • Added the ability to turn off invariant inheritance across assembly boundaries. This is needed if you cannot count on an assembly being rewritten where that assembly contains a base class (with an invariant) for a class that that has an invariant in the assembly that is being rewritten.
  • The static checker now is adapative: it chooses which domains to use based on the complexity of the method it is analyzing.

Release 1.4.30903.0 (September 3, 2010)

  • The static checker employs a cache (when the option is turned on in the properties pane) to speed up the analysis.
  • Improved static checker performance (in addition to the caching).
  • Better contract extraction for CCDoc. Fixed a bug that prevented it from working for VB projects.
  • Added contracts to the framework reference assemblies. (Thanks to everyone on the forum for proposing so many of them!)
  • Fixed a problem in refasmgen (the tool that creates reference assemblies when that option is turned on in the properties pane) so that it doesn't crash and even better gives improved source texts.
  • The static checker now will infer the postcondition that the return value is non-null in some simple cases.
  • Lots of other bug fixes.

Release 1.4.30707.2 (July 7, 2010)

This release fixes a number of bugs.

  • Contracts
    • Added some missing contracts in mscorlib.dll and System.dll
    • Fixed some extraction problems that led to null dereferences.
  • Runtime Checker
    • Fixed a problem where contracts in iterators were not always properly recognized
    • Fixed closure handling for VB generated code
  • Static Checker
    • Fixed problem where the new "container analysis" option for dealing with Contract.ForAll was not written to the project file.
    • Fixed problems with Ensures on virtual methods to get properly specialized

Release 1.4.30629.0 (June 29, 2010)

This release contains mostly bug fixes. The static checker now has some support for Contract.ForAll.

Runtime Checking

  • Fixed bug in extraction from iterator methods
  • Fixed bug writing exactly 20 exception handlers
  • Cleaned up behavior when "assert of failure" is selected. Legacy requires and Requires<E> will assert and then throw. The assert can be masked by the handler, but not the throw.
  • Stricter checking of contract well-formedness.
  • Contract extraction is lazier and should result in fewer dlls getting loaded and faster rewriting.
  • Invariant checks should now check the invariant of the dynamic type, not just the static type.

Static Checking

  • Initial support for Contract.ForAll. E.g., contracts on IEnumerable's containing non-null elements can now be expressed and handled. There are limitations though: when a collection is modified (by adding to a list e.g.), the static checker loses all knowledge about the elements. Also, contracts on scalars in enumerables do not work yet.
  • Many bug and precision fixes.

 

Release 1.3.30524.1 (May 24, 2010)

New features

Please read the updated documentation on details of the new features. The documentation now has a "What's new" section at the beginning with pointers to relevant changed parts.

  • Assembly Mode: Makes it explicit if the rewriter is used on release builds or not. See section 5.1 in the documentation.
  • Contract Argument Validator Methods
    Factor legacy if-then-throw sequences and use them as if they were primitive contract methods.
  • Contract Abbreviator Methods
    Factor non-legacy requires contracts and use them as if they were primitive contract methods.
  • ContractOption attribute
    Provides on/off control over inheritance and runtime checking at assembly, type, or method granularity

Many fixes and improvements

  • Installer setting of environment variable problem fixed
  • Proper extracting source text from Requires(Of …)(…) in VB
  • Proper extracting source text from If .. Then legacy in VB
  • Pop up box due to missing source context in error list fixed
  • Some performance improvements in rewriter
  • Complicated generics are now better handled in assembly reader
  • Numerous fixes to static checker precision/correctness
  • Recursion guards are not omitted when recursion is obviously not present
  • More robust msbuild hook integration
  • Stricter checking of contract well-formedness

Release 1.2.30312.0 (March 12, 2010)

Installer

  • Should now properly recognize Architect edition
  • Should install on build servers

Contract Extraction

  • Better warnings when Invariant method contain bad contract uses

Runtime Checker

  • Turn off invariant checking during any method which in the end will check its invariants
  • Check invariant on exceptional exit from exceptions advertised via EnsuresOnThrow
  • Emit proper pdb information to avoid spurious uncovered blocks in generated code when code coverage metrics are employed. For contracts, coverage is achieved when every condition is evaluated by the tests
  • Fix incorrectly generated call-site wrapper for internal protected methods
  • Don’t turn invariants on auto-properties that override/implement into pre/post
  • Parameters appearing in ensures are now implicitly treated as wrapped inside OldValue
  • /throwOnFailure is now the default

Contract Reference Assemblies

  • Contract reference assemblies are now placed in a sub-directory called CodeContracts of the regular project bin output directory instead of the output directory itself. This change addresses an issue where some frameworks/tools (e.g. ASP.Net) would try to load the contract reference assemblies and fail.
  • Added contracts to System, System.Web, System.Security

Static Checker

  • Out and by-ref parameters of pure methods are now properly treated as assigned after the call
  • Calling Monitor methods causes the static checker to assume that more of the world has changed than previously.
  • Various performance and precision improvements and fixes
  • Using a method not marked with Pure in a contract now only emits one warning, rather than repeated warnings and is treated as pure by the analyzer
  • ContractVerification attribute is now recognized on properties rather than just on the getter/setter.
  • Fix to string format issues in output messages

Release 1.2.30118.5 (Jan 18, 2010)

Quick bug-fix release to address bad code generation and extraction issues in 1.2.30113.1.

  • Auto-properties containing && ||, or ? should now be handled properly
  • Fixed default parameter constant encoding
  • Fixed some contract inheritance problems with generics and closures

Release 1.2.30113.1 (Jan 13, 2010)

Contracts

  • Silverlight 4 support added, Silverlight2 dropped.
  • We now have a set of contract reference assemblies for the different target frameworks (3.5, 4.0, Silverlight 3.0, Silverlight 4.0). This allows contracts on newer APIs and avoids problems where the rewriter added the wrong references to the target assembly.
  • Contract invariant methods now must be private.
  • Invariants on auto properties are turned into pre and post conditions of the corresponding setter and getter. This permits using auto properties with contracts.
  • Added more contracts to System.Linq, System.Net, System.Collections, System.Data, System.Math namespaces
  • Fixed issues of referencing v3.5 assemblies with contracts from v4.0 projects
  • Tweaks to extraction of contracts from VB constructors

Runtime Checker

  • Makes sure contract invariant methods are not called directly
  • Object invariants are now delayed until the end of the constructor to avoid checking them prematurely
  • Fixes to contract inheritance that would generate bad IL.
  • Avoid FxCop warnings about catching all exceptions in OldValue expressions
  • Initial support for ContractIgnoredAttribute added (see documentation)
  • Fix in rewriting attributes with arrays of enums
  • Fixed codegen issues when removing Assert/Assumes from code

Documentation Generation

  • Fixed path problems
  • Fixed inheritance problems

Static Checker

  • Improved handling of IsNan
  • Improved error messages now include the condition in all cases (not just for other assemblies)
  • Improved interval analysis
  • Improved handling of box operations
  • Squigglies now work in VS2010
  • Fixed handling of unicode error messages in the output
  • Better handling of IntPtr and UIntPtr
  • Better handling of inferred mutations at method calls
  • Masking of warnings at the assembly level using SuppressMessage now supported for global warnings

 

Release 1.2.21023.14 (Oct 24, 2009)

A quick bug fix release for the problem on VS2010 Beta2 where the static checker errouneously warns about adding requires in contract classes for interfaces.

Other improvements:

  • The rewriter now checks if the produced assembly remains verifiable
  • Static checker handling of boxing improved

Release 1.2.21022.12 (Oct 22, 2009)

This release mainly contains bug fixes.

VS2010 Beta 2 now supported

  • Starting with this version, VS2010 Beta 2 is supported.
  • Known Beta2 issues: some messages from static checker seem to be missing on first builds after loading a project/solution. Rebuild should solve it.

Contract Reference Assemblies

In previous versions of the tools, contract reference assemblies were built automatically on-demand for any project referenced by a project that used contracts. We changed this so that you need to enable "Build" for contract reference assemblies on any project for which the contract reference assembly may be needed. Please see Section 6.4 in the user documentation for more info on this.

Runtime Checker

  • Fixed object invariant inheritance for runtime checking which resulted in code generation errors.
  • Fixed inheritance of interface contracts onto structs (caused bad code in some cases)
  • Old value evaluation now under try-catch to guard against conditionally needed old values
  • Stricter checking of usage of contract methods
  • Fixed generic method instantiation related to nested classes
  • Better source contexts for some errors
  • Fix for missing source files for WPF projects

Static Checker

  • Fixed wrong reporting of unreached code
  • Improved precision for handling lengths of generic collections
  • Fixed several bugs caused by large numbers
  • Fixed working of warnings on unnecessary assumptions

Framework Contracts

  • Added contracts in System.Windows.Forms
  • Added contracts in System.Data

Release 1.2.20903 (4 Sep 2009)

Feature updates

  • No API changes!
  • Silverlight 3 support
  • New tool:
    • Contract documentation generation via XML docs and Sandcastle
    • Please read the documentation and the CodeContracts/Sandcastle/Readme reachable from the Start Menu
  • Runtime checking
    • Object invariant can be split into multiple methods
    • Object invariant methods can be private
    • Initial support for contracts on iterators
  • Static checking
    • Support for floating point reasoning
    • Check for redundant assumptions
  • More contracts for framework assemblies

Bug fixes

  • Bad Contract Reference Assemblies for .NET have been fixed. This should fix problems with “method not found” failures and other verification problems in the rewritten code.
  • Contract reference assemblies should now work for Silverlight 2 and 3. Warnings related to X509 certificate types should be gone.
  • Better extraction of contracts from constructors in C# and VB
  • Handling of contracts involving generic methods
  • Handling of compiler generated locals shared between contracts and method bodies.
  • Handling in generated code to throw user selected exception when constructor unavailable
  • Stack overflow issues in static checker.

Release 1.2.20518 (20 May 2009)

Heads up: This release contains some changes to the Contracts API and
its usage guidelines. Please review the beginning of Section 5 in the
documentation even if you looked at it in the past. Also, the runtime
behavior has changed again. Please see Section 7 in the documentation.

Feature updates

  • Contract.RequiresAlways deprecated
  • Contract.Requires<TException> added
  • ContractException is now internal
  • Contract tools work with VS2010 Beta1.
  • Runtime checking
    • Client side requires checks (Section 6.1)
    • Check box allows switching between assert/throw behavior
  • Static checking
    • SuppressMessage attribute supported
    • Many more contracts for framework assemblies

Bug fixes

  • Hang issue of both rewriter and static checker due to Pdb reading
    fixed.
  • Abstract class contracts properly inherited when generics and closures involved.
  • Ambiguity between user and condition strings in contract reference assemblies removed.
  • Static checker no longer fails when Linq expression trees are present.
  • Fixed bug in MSBuild integration where wrong KeyContainer was used for signing.
  • Many static checker precision improvements.

Release 1.1.20415 (15 April 2009)

This release adds a commercial version for Standard VisualStudio 2008 (without the static checker). In addition the following issues were addressed:

  • More contract reference libraries for System.Xml, System.Data, System.Windows.Forms, System.Drawing, System.Security
  • Contract class allows partially trusted callers
  • Silverlight and WPF builds now supported

Runtime Checker fixes

    • Pure is now inherited and need not be repeated on overrides/implementations
    • Fixed problem with level of checking being applied incorrectly to inherited contracts
    • Provided more levels of checking
    • Allow erasure of all contracts not on public surface of an assembly
    • Fixed debugging issue with Silverlight applications
    • Fixed Ensures source context issues to improve stepping accuracy
    • Fixed problem with contract reference assemblies for executables

Static Checker fixes

    • Pure functions of multiple arguments are now handled
    • Strongly typed resources are assumed non-null
    • Unsatisfiable requires are now flagged
    • VB constructors can now have contracts (fixed extraction problem)
    • Property Pane custom arguments can now override default arguments

Release 1.1.20309 (9 March 2009)

This release fixes a number of smaller issues with the prior release:

  • Changed the default behavior for contract failure. It now throws a ContractException containing the failure kind (requires,ensures, etc), as well as the condition and potential user string. The ContractFailed event still allows further customization
  • Many more contracts for BCL libraries have been written. Please report high priority areas where we are still missing them or where they seem wrong.
  • Option for checking arithmetic properties (div by zero and negation of minint) now in the UI.
  • Code snippets for VB installed
  • Bug fixes
    • Purity now visible from contract reference assemblies
    • InternalsVisibleTo should now work when using the static checker
  • Initial preview of Silverlight support. The rewriter runs and instruments the code, but debugging (stepping, breakpoints) does not work yet.

Release 1.1.20215 (23 February 2009)

This is a major revision of the tools from the previous 1.0.1 release in terms of quality improvements.

  • Interface contracts are now fully supported.
  • Generics are fully supported.
  • Many precision improvements to static checking
  • Samples with documentation
  • Integration of warnings in Visual Studio Error List and squigglies
  • Background Static Checking
  • Initial contracts for mscorlib.dll and Microsoft.VisualBasic.dll.
  • Updated documentation.