none
Can not find ContractInvariantMethodAttribute in Fakes.dll

    Question

  • Hi,

    I'm getting build warnings when using Fakes with CodeContracts

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll :
    warning : CodeContracts: Could not find the method/type 'System.Diagnostics.Contracts.ContractInvariantMethodAttribute'
    in assembly 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll'

    Any way of fixing this? (either addressing the problem, or forcing the warning to be ignored)

    Regards.

    Any one?

    Edit:

    Still seeing this with VS2013

    "C:\XXX\XXX.csproj" (default target) (1) ->

    (CodeContractsRunCodeAnalysisInternal target) ->

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.QualityTools.Testing.Fakes.dll : error : CodeContracts: Could not find the method/type 'System.Diagnostics.Contracts.ContractInvariantMethodAttribute' in assembly 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.QualityTools.Testing.Fakes.dll' [C:\XXX\XXX.csproj]

    From the msbuild output it gets reported during "CodeContractsRunCodeAnalysisInternal"

    CodeContractsRunCodeAnalysisInternal:

      CodeContracts: Task manager is unavailable (unable to run in background).

      CodeContracts: XXX: Run static contract analysis.

      CodeContracts: XXX: Time spent connecting to the cache: 00:00:02.1958164

      CodeContracts: XXX: Cache used: (LocalDb)\v11.0

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.QualityTools.Testing.Fakes.dll : error : CodeContracts: Could not find the method/type 'System.Diagnostics.Contracts.ContractInvariantMethodAttribute' in assembly 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.QualityTools.Testing.Fakes.dll' [C:\XXX\XXX.csproj]

      CodeContracts: XXX: Validated:  99.5%

      CodeContracts: XXX: Checked 204 assertions: 203 correct 1 unreached

      CodeContracts: XXX: Contract density: 1.69

      CodeContracts: XXX: Total methods analyzed 63

      CodeContracts: XXX: Methods with 0 warnings 62

      CodeContracts: XXX: Total method analysis read from the cache 63

      CodeContracts: XXX: Total time 8.798sec. 139ms/method

      CodeContracts: XXX: Retained 0 preconditions after filtering

      CodeContracts: XXX: Inferred 0 object invariants

      CodeContracts: XXX: Retained 0 object invariants after filtering

      CodeContracts: XXX: Detected 0 code fixes

      CodeContracts: XXX: Proof obligations with a code fix: 0

      CodeContracts: Checked 204 assertions: 203 correct 1 unreached

      CodeContracts: XXX:

      CodeContracts: XXX: Static contract analysis done.

    • Edited by gallóglaigh Thursday, September 04, 2014 7:55 AM
    Thursday, May 23, 2013 4:48 PM

Answers

  • Hi! I know this is ridiculously late, but I came over this issue, and found a solution that at least worked for me.

    http://stackoverflow.com/questions/30641671/codecontracts-fails-the-build-for-seemingly-no-reason/30668468#30668468
    • Marked as answer by gallóglaigh Tuesday, December 06, 2016 10:49 AM
    Friday, June 05, 2015 2:06 PM

All replies

  • Hi,

    I'm getting build warnings when using Fakes with CodeContracts

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll :
    warning : CodeContracts: Could not find the method/type 'System.Diagnostics.Contracts.ContractInvariantMethodAttribute'
    in assembly 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll'

    Any way of fixing this? (either addressing the problem, or forcing the warning to be ignored)

    Regards.

    Any ideas?

    Thanks.

    Tuesday, June 11, 2013 10:57 AM
  • Any one have any ideas on this?
    Thursday, September 05, 2013 10:34 AM
  • Hi! I know this is ridiculously late, but I came over this issue, and found a solution that at least worked for me.

    http://stackoverflow.com/questions/30641671/codecontracts-fails-the-build-for-seemingly-no-reason/30668468#30668468
    • Marked as answer by gallóglaigh Tuesday, December 06, 2016 10:49 AM
    Friday, June 05, 2015 2:06 PM
  • Hi,

    I know this is even more ridiculously late!

    Thanks for finding a solution.

    Tuesday, December 06, 2016 10:51 AM