微软代码契约:错误" CodeContracts:诊断:无法连接到任何高速缓存" [英] Microsoft Code Contracts: Error "CodeContracts: Diagnostic: Failed to connect to any cache."

查看:158
本文介绍了微软代码契约:错误" CodeContracts:诊断:无法连接到任何高速缓存"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行Microsoft代码契约时,收到以下错误:




CodeContracts:诊断:无法连接到任何高速缓存。



解决方案

的代码契约用户手册规定:




缓存的结果:控制如果分析结果被缓存。如果
检查,分析试图避免在分析其结果
不可能改变(因为没有合同,没有代码,并没有相关
metdata已经改变)方法。启用此选项允许更快的
周转时间,如果反复使用静态检查。 要共享多个开发商之间的
缓存,使用SQL服务器,并在UI中的SQL Server conguration箱放到服务器
名称
注意:在SQL
服务器连接使用Windows身份验证登录到服务器上。
你的开发人员将需要创建和修改数据库的权限。




了解SQL服务器安装在正确的名称你机(注意本地主机是行不通的;它必须是实际的机器名):





在项目点击右键,选择属性,进入代码契约标签(下列表的底部),然后添加您的计算机名称:





这适用于版本1.5.60911.10(2013年9月11日)。代码契约也许未来的版本将尝试连接到本地主机和/或在此框中接受本地主机,和/或自动检测SQL Server 2012中。



在我的具体情况,我没有(的LocalDB)\V11.0安装;如果我已经安装了这种话,那就得(它必须在内部默认为这个)盒子的制定。


I get the following error when running Microsoft Code Contracts:

CodeContracts: Diagnostic: Failed to connect to any cache.

解决方案

The user manual for Code Contracts states:

Cache results: Controls if the analysis results are cached. If checked, the analysis tries to avoid analyzing methods whose outcomes cannot possibly change (because no contracts, no code, and no relevant metdata has changed). Enabling this option allows for faster turn-around times if using the static checker repeatedly. To share the cache among multiple developers, use a SQL server and put the server name in the SQL Server conguration box in the UI. Note: the SQL server connection uses Windows authentication to log onto the server. Your developers will need the right to create and modify databases.

Find out the correct name of SQL server installed on your machine (note that "localhost" will not work; it has to be the actual machine name):

Right click on the project, select "Properties", go to the "Code Contracts" tab (down the bottom of the list), then, add your machine name:

This works for Release 1.5.60911.10 (Sep 11, 2013). Perhaps future versions of Code Contracts will attempt to connect to "localhost" and/or accept "localhost" in this box, and/or automatically detect SQL Server 2012.

In my particular case, I didn't have "(localdb)\V11.0" installed; if I had installed this then it would have worked out of the box (it must be defaulting to this internally).

这篇关于微软代码契约:错误" CodeContracts:诊断:无法连接到任何高速缓存"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆