.NET Core:代码合同方法目前已关闭? [英] .NET Core: Code Contracts approach is closed for now?
问题描述
几年前,有很多有关代码合同的信息.我没有时间去学习它,只是现在才发现:)
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将包含一个新的可引用类型功能,将处理使用代码协定的大部分不变式和前提条件和后置条件.这将有助于检测和避免可能的空引用异常.
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屋!