.NET Core:代码契约方法暂时关闭? [英] .NET Core: Code Contracts approach is closed for now?

查看:33
本文介绍了.NET Core:代码契约方法暂时关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年前有很多关于代码契约的信息.我没有时间学习它,现在才发现这个:)

Some years ago was many information about Code Contracts. I did not have time to learn it and found this time only now :)

但是当我尝试使用它时,我发现 Visual Studio 2017 不支持它,CC 工具上次更新是在 3 年多前......

But when I try to use it, I see, that Visual Studio 2017 does not support it, CC tool is updated last time more than 3 years ago...

那么,代码合同暂时关闭了?

So, Code Contracts is closed for now?

推荐答案

遗憾的是,不再支持代码契约.

Sadly, Code Contracts is no longer supported.

好消息是 C#8 将包含一个新的可以为 null 的引用类型特性将处理大部分使用代码契约的不变量和前置和后置条件.这将有助于检测和避免可能的空引用异常.

The good news is that C#8 is going to include a new nullable reference types feature that will handle a large portion of the invariants and pre- and post-conditions for which Code Contracts was used. This will assist with detecting and avoiding possible null-reference exceptions.

坏消息是,没有对其他类型合约的内置支持,未来也没有类似的公告.

The bad news is that there is no built-in support for other types of contracts, and nothing like it has been announced for the future.

正确性保证必须来自第三方工具,或者必须使用其他语言(例如,艾达火花).

Correctness guarantees will have to come from third-party tools, or another language will have to be used (e.g., Ada Spark).

这篇关于.NET Core:代码契约方法暂时关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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