Is all .NET updated to use Contracts?

Since contract entry into .NET 4.0, I have been wondering if Microsoft has extended this to all of its classes, as in BCL?

If not, why? This function only makes sense if it is supported by the standard library by default, right?

+4
source share
2 answers

No code contracts have been added to the entire BCL. Many of the more common classes have added annotation, but not all BCLs.

The main reason here is time. BCL is huge and adding the right contracts to the whole BCL is a massive event. And the result, currently, benefits only a small subset of the .Net database. If contracts grow in popularity, I’m sure that their use in BCL will also grow (yes, I understand that not doing this makes the other less likely)

This issue is mitigated, although it allows users to declare custom Contract assemblies. This allows them to publish annotations of types that were skipped and get to the point where their code base is clean in terms of Contracts.

+2
source

Not all BCL.

Consider code contracts not yet fully integrated into the IDE and language; This is a separate download. Undoubtedly, when he achieved more developer penetration, higher integration with the IDE and the full BCL annotation that we will see are offered out of the box.

+2
source

Source: https://habr.com/ru/post/1342681/


All Articles