docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Have It support "CodeContracts"?

Open yaochangyu opened this issue 9 years ago • 7 comments

Have It support "CodeContracts"

I via Sandcastle can generate "CodeContracts" of document https://marketplace.visualstudio.com/items?itemName=RiSEResearchinSoftwareEngineering.CodeContractsforNET

How to via docfx can generate "CodeContracts" of document?

yaochangyu avatar Apr 07 '17 09:04 yaochangyu

Reading code contract spec, docfx can reflect related attributes but not support generating CodeContracts of document yet? @vwxyzh @vicancy

hellosnow avatar Apr 10 '17 03:04 hellosnow

Hi hellosnow, I can not generate "CodeContracts" of document. I don't know docfx have support "CodeContracts"?

yaochangyu avatar Apr 10 '17 15:04 yaochangyu

Docfx doesn't support CodeContracts yet, I will play on Sandcastle to try generating CodeContracts first, then try to run docfx to check whether we have reflected related attribute like ContractInvariantMethod. Our attributes in yaml file is like Attribute sample in Yaml.

Have you tried to run your project by docfx? If possible, could you share with us the yaml files?

One more, could you share with us the links about Sandcastle generated html files? We're interested on what information is needed in the final page.

hellosnow avatar Apr 11 '17 09:04 hellosnow

I tried to generate code contracts:

  • source code: https://github.com/hellosnow/ForCodeContract/tree/master/TestCodeContracts
  • generated yaml files: https://github.com/hellosnow/ForCodeContract/tree/master/yaml
  • generated html file snapshot: code contracts in docfx

@yaochangyu from your blog post 使用 Sandcastle 自動產生 Code Contract 說明文件, we found a snapshot to describe how it looks like using Sandcastle: sandcastle with code contracts

From the above, we can come into conclusion that docfx haven't support generating section for code contracts, but already generated the attributes via ContractInvariantMethodAttribute.

If we need to support code contracts, need to update the template such as class template, much similar as exception section. @yaochangyu if you're interested in it, welcome contribute on that.

hellosnow avatar Apr 17 '17 08:04 hellosnow

@hellosnow Hi hellosnow 使用 Sandcastle 自動產生 Code Contract 說明文件,That's my blog. How to use new feature?

yaochangyu avatar Jul 28 '17 03:07 yaochangyu

@yaochangyu yes i found it from your blog.

hellosnow avatar Jul 28 '17 03:07 hellosnow

Code contracts aren't supported in .NET 5+ (including .NET Core versions). Consider using Nullable reference types instead.

yufeih avatar Apr 12 '23 07:04 yufeih