3

当我重建我的 C# 应用程序时,我经常没有得到我的代码合同分析的结果。这是由以下错误消息引起的

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

这是方法的定义

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

这并不总是超时。有没有一种方法可以让我只为一个项目手动运行合同检查,而不是通过重建解决方案对所有项目进行检查?

4

1 回答 1

2

You can increase the timeout for that project by adding an extra option to the static checking options in the property pane as follows: -timeout

The default is 180, which is per method.

As to your original question, yes you can run the tools manually as follows:

Say your project P is in directory D, then go to D\obj\Debug\Decl. In there you'll find a convenient file called Pcccheck.rsp which contains the parameters which were passed to cccheck during the build. To run the analysis again, you simply issue: cccheck @Pcccheck.rsp

Right now, there isn't an option to trigger a re-analysis of just one project without a rebuild.

于 2013-04-24T20:32:48.337 回答