Can I run Code Contract Analysis manually?

When I rebuild my C # application, I often don't get the results of my analysis of code contracts. This is caused by the following error message

CodeContracts: MyApp.Client.Model: Analysis method MyApp.Client.Model.MyClass.CreateCalculatedElements(System.Collections.Generic.List1<System.Collections.Generic.KeyValuePair2<System.String,MyCompany.Scripting.ICompiledFunction1<System.Object>>>,System.Collections.Generic.Dictionary2<System.String,MyCompany.Scripting.ICompiledFunction1<System.Decimal>>,System.Collections.Generic.Dictionary2<System.String,MyCompany.Scripting.ICompiledFunction1<System.Decimal>>) timed out

Here is the definition of the method

internal void CreateCalculatedElements(
List<KeyValuePair<string, ICompiledFunction<object>>> preFinalCalculationScripts,
Dictionary<string, ICompiledFunction<decimal>> factorCalculators,
Dictionary<string, ICompiledFunction<decimal>> elementCalculators)

      

It's not always a timeout. Is there a way that I can manually check contracts for just one project and not all of them using a rebuild solution?

+3


source to share


1 answer


You can increase the timeout for this project by adding an additional option for static check options in the property bar as follows: -timeout

The default is 180, which corresponds to the method.

As for your original question, yes, you can start the tools manually like this:



Say your project P is in directory D, then navigate to D \ obj \ Debug \ Decl. There you will find a handy Pcccheck.rsp file that contains the parameters that were passed to cccheck at build time. To run the analysis again, you simply do: cccheck @ Pcccheck.rsp

There is currently no way to initiate reanalysis of just one project without rebuilding.

+2


source







All Articles