Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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>());
       }
   }
 

http://i.cubeupload.com/U3cmxi.png -> Constructor has no Code Contracts displayed in ToolTip
 
http://i.cubeupload.com/NWZFwo.png -> Method has Code Contracts displayed in ToolTip
 
Many thanks
Posted 12-Mar-13 4:26am
Edited 12-Mar-13 12:57pm
v3
Comments
Sergey Alexandrovich Kryukov at 12-Mar-13 11:20am
   
Not clear. A short but comprehensive code sample would help...
—SA
DrNimnull at 12-Mar-13 16:01pm
   
I have edited my Question. Hope it´s a bit more clear?
Sergey Alexandrovich Kryukov at 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?..
—SA
DrNimnull at 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 at 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?
—SA

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

  Print Answers RSS
0 OriginalGriff 319
1 Kornfeld Eliyahu Peter 265
2 Maciej Los 249
3 BillWoodruff 205
4 Sergey Alexandrovich Kryukov 175
0 OriginalGriff 5,107
1 DamithSL 4,157
2 Maciej Los 3,595
3 Kornfeld Eliyahu Peter 3,450
4 Sergey Alexandrovich Kryukov 2,741


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2014
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