代码编辑器扩展:set属性不显示元数据上的契约(转到定义F12) [英] Code editor extension: set properties don't show contracts on metadata ( Goto Definition F12 )

查看:69
本文介绍了代码编辑器扩展:set属性不显示元数据上的契约(转到定义F12)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在查看时没有看到任何X属性的合约 此类的元数据文件。我使用VS2012。


公共课Class1

    {

        private int _x;


        public int X

        {

           设为

            {

                Contract.Requires(值GT; =  0);

              &NBSP ; _x =值;

            }
        }
    }









解决方案


你能告诉我更多关于什么项目,你是当你正在做的F12中,它的与包含Class1的项目的关系?合同的F12元数据视图仅适用于您的解决方案中没有的代码,但我们可以找到合同引用
程序集(MyAssembly.Contracts.dll)。


如果Class1在你的解决方案中,那么F12只会转到定义本身。


如果你将鼠标悬停在X(属性名称)上,你应该在setter上看到需求,前提是你已经启用了选择"Build"。对于CodeContract属性窗格中包含Class1的项目的Contract Reference Assembly。




I don't see any contracts for X property when I'm viewing  the metadata file for this class. I use VS2012.

public class Class1
    {
        private int _x;

        public int X
        {
            set
            {
                Contract.Requires(value >=  0);
                _x = value;
            }
        }
    }


解决方案

Can you tell me more about what project you are in when you are doing F12 and it's relation to the project containing Class1? The F12 metadata view of contracts works only for code that is not in your solution, but for which we can find a contract reference assembly (a MyAssembly.Contracts.dll).

If Class1 is in your solution, then F12 just goes to the definition itself.

If you hover over the X (the property name), you should see the requires on the setter, provided that you have enabled the selection "Build" for the Contract Reference Assembly of the project containing Class1 on the CodeContract property pane.


这篇关于代码编辑器扩展:set属性不显示元数据上的契约(转到定义F12)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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