Click here to Skip to main content
12,399,799 members (48,935 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# VS2010 Extension
There is a Visual Studio Extension: Code Contracts Editor Extensions. This extension displays code contracts.

The extension works and displays the code contracts in the ToolTip of a method, but I'm not getting the code contracts in the ToolTip for constructors.

Is there a possibility to display 'Code Contracts' in Visual Studio as ToolTip for constructors?

I´ am using .Net 4.0 in MS Visual Studio 2010 Professional.

Here is the Example-Code:
class Foo
       public Foo(string name)
           Contract.Requires<ArgumentNullException>(name != null, "name");
       public void Execute(ICollection<int> executedIds)
           Contract.Requires<ArgumentNullException>(executedIds != null, "executedIds");
   class Bar
       public static void Execute()
           var foo = new Foo("foo");
           foo.Execute(new Collection<int>());
   } -> Constructor has no Code Contracts displayed in ToolTip -> Method has Code Contracts displayed in ToolTip

Many thanks
Posted 12-Mar-13 3:26am
Updated 12-Mar-13 11:57am
Sergey Alexandrovich Kryukov 12-Mar-13 11:20am
Not clear. A short but comprehensive code sample would help...
DrNimnull 12-Mar-13 16:01pm
I have edited my Question. Hope it´s a bit more clear?
Sergey Alexandrovich Kryukov 12-Mar-13 16:55pm
Yes, it is, thank you very much for clarification. Unfortunately, at this moment I don't know the answer, perhaps someone else can help...
Do you mean Intellisense, which is technically, not a tooltip?..
DrNimnull 12-Mar-13 18:00pm
Thanks. You´re right. The code contracts are only displayed in the ToolTip. To avoid confusions I removed Intellisense from my question. Although the 'Parameter Info' (->ToolTip) is also part of Intellisense =).
Sergey Alexandrovich Kryukov 12-Mar-13 18:14pm
Great. Well, I guess this is a matter of delving deeper into VS add-in SDK... I'm just curious: why would you need those ToolTips, if the project you referenced provides Intellisense support for them? Is it not good enough?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100