Solved

Displaying values as tooltip in debugger

Posted on 2014-04-25
7
247 Views
Last Modified: 2014-04-25
I'm using VS 2008, Visual Basic. When I'm in debug mode, if I hover the mouse over a variable, the variable's value displays in a tooltip box. However, that doesn't happen if the variable is qualified with a dot, whether to call a property (ThisForm.Width) or to execute a method (ThisDate.AddDays(1)). I can right-click on the variable and choose Add Watch, which displays the value in the Watch window, but that's tedious and quickly builds up a large list of variables to display.

Is there any way to get the tooltip display to work for variables with dots and members after the name?
0
Comment
Question by:ElrondCT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40023641
I'm afraid I'm not sure what you mean. Mousing over properties works fine for me:

Screenshot
Now method calls are different because methods have to actually be executed in order to see their values. You can paste method calls (as well as properties) into the Immediate Window (Debug->Windows->Immediate), and prepend the call with a question mark to inspect its value.

e.g.

Screenshot
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 40023662
Oops, you're right. Properties are visible. However, if a method is called, no tooltip is available, either for the result of the method or for the original variable or control. Yes, I can display it in the Immediate window (or the Watch window, as I mentioned), but I was wondering if I was missing a more direct way to view them. Particularly if it's a control or a datatable/dataset, the display windows are less than ideal; the dataset visualizer, for instance, isn't available at all.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40023689
VB isn't my main langauge, and it's been a good while since I've done active development in it, so please wait for additional responses. One alternative I can think of--and it will take some upfront investment--would be to have properties that call your method behind the scenes. You could include conditional compilation in your project to only build such properties for your development version. As I said, there would be an investment because you'd now have to write a property for each method you care about. Less than ideal, but if you really need it versus using Watch or Immediate Window...

e.g.

Module Module1

    Sub Main()
        Dim x As New Test()

        Console.WriteLine(x.ThisTest)
        Console.WriteLine(x.ATest())

    End Sub

End Module


Public Class Test
    Public Property ThisTest()
        Get
            Return "hello world!"
        End Get
        Set(ByVal value)

        End Set
    End Property

    Public Function ATest() As String
        Return "Hello World!"
    End Function

#If DEBUG Then
    Public ReadOnly Property DBG_ATest() As String
        Get
            Return Me.ATest()
        End Get
    End Property
#End If
End Class

Open in new window


Screenshot
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40023695
P.S.

I suspect the reason why you don't get tooltips for methods but you do for properties is because even though properties technically get compiled into methods during the build, the assumption is that properties only provide data access--there are no side effects to worry about when accessing a property...at least there aren't supposed to be. With a method, depending on how it is written, the method could mutate the internal state of the object on each call to the method. As I said before, methods have to be executed, so the act of showing the method's return value in a tooltip would cause the method to execute. If the method was a mutator method, then you would be modifying your object's state every time you viewed the tooltip. Very less than ideal!

P.P.S.

Using the conditionally-compiled property that I demonstrate above would have an equivalent effect as the mutator method I mention above, if the underlying method being called is a mutator method.
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 40023717
Thanks, Kaufmed, but I'm looking for something generalized, not for a specific item, the same way that mousing over variables (that don't have methods attached) allows me to quickly view the current values.

Yes, I can easily see how executing methods in the middle of a display could cause problems, though they do work in a Watch window. I'd really be perfectly happy seeing the value for the underlying object with no method activity (IOW, what I'd see now if the method weren't attached). There is, no doubt, ambiguity there--are you seeing the variable, or the result of the method--but as long as it's consistently displayed, I don't see that that should be a problem. This may be more a wishlist item; I just wondered if there was some way to get there already that I was unaware of.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40023733
There is a more direct way of having the result of a method, that won't fill up you Watch window. It's the Quick Watch, available through a right click on the call, or Shift-F9 when the cursor is on it.
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 40024052
Ah, that's it! Quick Watch does exactly what I want--it displays the underlying object that I click on, and I can see all properties, or with a dataset, I can view the dataset visualizer. Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question