none
Code Contracts compatibility

    Pertanyaan

  • Are there known issues concerning compatibility of roslyn with Code Contracts.

     

    There are some solutions, which don't use roslyn, whose build is failing since I installed roslyn.

     

    These Project have static activated Code Contracts.

    When I deactivate roslyn, everything works fine.

     

    Here the build output

     

    CodeContracts: BE.Core: Run static contract analysis.
    CodeContracts: BE.Core: Static contract analysis done.
      elapsed time: 906,0518ms
    CodeContracts: BE.Core: Internal error at method Method 1 : BE.Collections.Concurrent.ConcurrentHashSet`1.get_SyncRoot
    CodeContracts: BE.Core: Failed with uncaught exception: [C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll] Gltiges TypeDef oder TypeRef-Token nach ELEMENT_TYPE_GENERICINST erwartet.
    CodeContracts: BE.Core: Stack trace:    bei Microsoft.Research.CodeAnalysis.OptimisticHeapAnalyzer`9.Domain.AnalysisDecoder.Entry(APC pc, Method method, Domain data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.StackDepthProvider`10.StackDecoder`3.Entry(APC pc, Method method, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.APCDecoder`9.RemoveBranchDelegator`3.Entry(APC pc, Method method, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.MethodCache`9.EntryBlock`1.ForwardDecode[Data,Result,Visitor](APC pc, Visitor visitor, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.MethodCache`9.ForwardDecode[Data,Result,Visitor](APC pc, Visitor visitor, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.APCDecoder`9.ForwardDecode[Data,Result,Visitor](APC pc, Visitor visitor, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.StackDepthProvider`10.ForwardDecode[Data,Result,Visitor](APC lab, Visitor visitor, Data data)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.ForwardAnalysisSolver`3.<>c__DisplayClass2`7.<Make>b__0(APC pc, AState state)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.ForwardAnalysisSolver`3.Transfer(APC pc, AState state)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.DFARoot`2.ComputeFixpoint()
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.ForwardDFA`2.Run(AState startState)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.CodeLayer`13.<>c__DisplayClass1`1.<CreateForward>b__0(AnalysisState initialState)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.OldAnalysisDriver`11.MDriver.RunHeapAndExpressionAnalyses()
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.AnalyzeNonIteratorMethodInternal(Method method)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.AnalyzeMethodInternal(Method method)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.AnalyzeMethod(Method method)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.AnalyzeAssembly(String assemblyName, Set`1 assembliesUnderAnalysis)
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.InternalAnalyze()
    CodeContracts: BE.Core:    bei Microsoft.Research.CodeAnalysis.Clousot.TypeBinder`9.Analyze()
    CodeContracts: BE.Core: 

     

    04 Desember 2011 11:51

Semua Balasan

  • Just for info, reinstalling roslyn and the CodeContracts (exact same version / installer) without no changes helped.

    No idea why...

    04 Desember 2011 13:17
  • This is certainly strange. We are not aware of any known issues around compatibility of Roslyn with Code Contracts.

    From the exception message above looks like you probably have a localized (German?) OS. An online translator tells me that the exception message "Gltiges TypeDef oder TypeRef-Token nach ELEMENT_TYPE_GENERICINST erwartet." translates to "TypeDef or TypeRef token is expected to/after ELEMENT_TYPE_GENERICINST". I am not sure exactly what this means / how this may have been caused by Roslyn.

    Its good to know that reinstalling Roslyn and Code Contracts fixed the issue. But do you have any additional details that may help us figure out what may have caused this? Thanks!


    Shyam Namboodiripad | Software Development Engineer in Test | Roslyn Compilers Team
    04 Januari 2012 1:45