SergeyTeplyakov / ReSharperContractExtensions

Set of extensions for R# that simplifies Design by Contract programming using Code Contracts.
MIT License
69 stars 10 forks source link

nameof() is not recognized as valid constant #59

Closed remyblok closed 9 years ago

remyblok commented 9 years ago

With VS2015 and C# 6 i now use the nameof-operator a lot. Also in code contracts like:

Contract.Requires(typeOfSource != null, nameof(typeOfSource));

I now get squiggles with the text: User messages to contract calls can only be string literals, or static field, or static property that is at least internally visible.

The nameof()-operator should be recognized as compile time static string. Thanks!

SergeyTeplyakov commented 9 years ago

Thanks a lot for bug report.

I'll add support for this feature soon.

SergeyTeplyakov commented 9 years ago

Fixed. Will release new version today or tomorrow.

Thanks for the bug report!

SergeyTeplyakov commented 9 years ago

Available at the latest release: https://github.com/SergeyTeplyakov/ReSharperContractExtensions/releases/tag/0.9.2.5