?
Solved

Displaying values as tooltip in debugger

Posted on 2014-04-25
7
Medium Priority
?
249 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 2000 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

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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