Justanothercoder
Justanothercoder

Reputation: 201

Visual Studio 2022 - Values while debugging (DataTips) not working while hover on properties c#

my question is about displaying values during debugging. My Visual Studio version is: Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.4.2

Since Visual Studio 2022, I noticed that I do not see values when hovering with the mouse on complex types in the debugger.

I remember that in older version you could always see the value of a variable by just hovering over the expression.

Now this only works on the root element. As soon as I want to see a property value of it, I now have to select the whole expression up to that point with the mouse.

Screenshot 1: "Password" has a value property is set

Screenshot 2: When I hover the mouse over Password, the value is not evaluated and displayed. [hovering on property not shwoing value

Screenshot 3: Only when I select everything, the value is displayed. hovering on property working when selecting

What can I do to get the same behavior as before? Just hover the mouse over it without selecting the whole expression.

Thanks for your help!

Research on the Internet brought up a few approaches, none of which could solve my problem.

In the Visual Studio settings I found no option to get the desired behavior

Upvotes: 20

Views: 18015

Answers (7)

Kanhaiya P. Baranwal
Kanhaiya P. Baranwal

Reputation: 111

Close VS solution, then delete the .vs temp folder in your solution directory. Open it again. It fixed problem for me. Some bug with VS 2022 which fixes on restarting.

Upvotes: 0

Douglas Marttinen
Douglas Marttinen

Reputation: 469

I just had this problem but for me it turned out my OneDrive for Business account corrupted my Documents/Visual Studio 2022/Visualizers folder.

I had to run: chkdsk c: /r /f in a Command Prompt, then after reboot deleted the folder.

I discovered this solution thanks to this: https://stackoverflow.com/a/67526748

Upvotes: 0

Paul Miller
Paul Miller

Reputation: 91

Visual Studio 2022 version 17.8.4 (Released 9th January 2024) fixes this.

Visual Studio 2022 v 17.8.4 Release Notes

Update (new answer): This issue is definitely related to screen resolution/scaling. I have 3 monitors. My "main" monitor is my laptop screen (3456 * 2160 @ 300% scaling) and my other two monitors are 1920* 1080 at 100% scaling.

Visual Studio always opens on my main screen (laptop) and then I move it to the right hand monitor afterwards. It seems that VS does its calculations when it starts up, because what I think is happening is the tooltips are showing, but they are not visible because they are off screen in the wrong place.

I have found 2 solutions for me that require no resetting:

  1. Close the laptop lid before running VS (assuming you have your machine power settings set up to ignore a lid close when plugged in). This forces VS to open on one of the monitors where I run it anyway.

  2. Set the monitor where I want to run VS as my "main" monitor (System -> Display -> Multiple Monitors -> Make this my main display). This used to be my laptop, but now it is the screen where I like to run VS. This works every time now.

Old answer:

You need to go to Tools -> Options -> Debugging -> General as Jingmiao Xu-MSFT says.

This problem seems to be a bug though as mine was already ticked and I couldn't see the values.

However, unticking "Enable property evaluation and other implicit function calls", exiting, then re-ticking fixed the problem for me (as did "repair", which takes ages).

Update: My VS has gone back to its old (broken) behavior again. Also, the tick -> untick -> tick method doesn't always work.

I have found executing this command to be more reliable, but clunky as it resets setting that you might want to keep (which you can also do by exporting those settings and re-importing).

This seems to work:

"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"/ResetUserData

The ResetUserData switch isn't documented but I found this:

Upvotes: 8

Lrego
Lrego

Reputation: 21

My solution was in resolution screens. Try to change scale of one of the screen or resolution. In my case I just decrease scale to 100% on small screen from 125%.

My answer was here: https://developercommunity.visualstudio.com/t/datatip-is-not-shown-when-using-two-screens-with-d/649598

Upvotes: 2

Pat
Pat

Reputation: 21

I just downgraded the Visual Studio back to previous version and it worked for me.

Upvotes: 1

JvR
JvR

Reputation: 1258

Close VS, then delete the .vs temp folder in your solution directory.

Upvotes: 16

Jingmiao Xu-MSFT
Jingmiao Xu-MSFT

Reputation: 2337

In your second screenshot you selected a whole line of code, so its value is not shown.

Here is my test screenshot:

1.Just hover over the property:

enter image description here

2.Select a whole line of code:

enter image description here

3.Select the property:

enter image description here

You can try just hovering over the property without selecting the whole line of code.

You can check the "Enable property evaluation and other implicit function calls" in Tools > Options > Debugging > General:

enter image description here

Upvotes: 0

Related Questions