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

7

17

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

Overspill answered 5/12, 2022 at 8:13 Comment(0)
C
14

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

Chuckle answered 20/11, 2023 at 12:20 Comment(4)
This was helped me to solve the issuePanelist
Vs2022 does not show variable values in my case after closing and deleting solution .vs temp folderMilan
This did not resolve the issue in VS2022, v17.10Inductance
This helped once, and then the problem came back.Subvert
C
8

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:

Colin answered 20/11, 2023 at 3:21 Comment(1)
The 2nd option worked for me in VS2022Shirashirah
G
2

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

Greenstone answered 5/12, 2023 at 17:26 Comment(2)
can you provide the answer here, now we need to look for it ourselvesHamlin
omg this is the answer!! Can't believe it was a just a glitch after all... Mine worked when I brought it to 4k monitor.Mixon
T
1

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

Thematic answered 20/11, 2023 at 16:17 Comment(0)
O
0

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

Oldfangled answered 20/2 at 20:2 Comment(0)
S
0

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.

Sudd answered 27/6 at 6:55 Comment(0)
F
-1

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

Fridge answered 6/12, 2022 at 2:17 Comment(8)
Hello, thank you for your comment! That's exactly my problem: simply hovering over the property doesn't work for me anymore. It only works if I select the row. And normally it should work as you describe: Just hover over it and read the value. Any Idea?Overspill
@Overspill I edited my answer, hope it can help you to solve the problem.Fridge
According to your description in the question: "Screenshot 2: When I hover the mouse over Password, the value is not evaluated and displayed." But the scrrenshot2 shows you selecting the whole line of code and then hovering over the property, it will not display the value of the property, you shouldn't select anything, just hover over the property. "It only works if I select the row" is that what is the case in screenshot3?Fridge
Having the same problem. Maybe it's a recent update? Sometimes it works and sometimes it doesn't. I have these options checked too and still not working.Microcyte
This was a recent update. How do I fix this damn it??Roodepoortmaraisburg
I have updated VS 2022 to version 17.8 in order to utilize .NET 8 and I am seeing the problem. I have checked the "Enable property evaluation" option and "Call string-conversion" and both are checked. I need a fix or remedy.Kusin
I also got the same issue when I updated the vs 2022 to the latest version(17.8). what I did was close vs and delete the .vs file and rebuild and debug the project.Panelist
Updated to v17.10, deleted the .vs folder, moved VS 2022 to the main monitor, checked settings, restarted VS 2022, rebooted. Nothing works. Is there any remedy?Inductance

© 2022 - 2024 — McMap. All rights reserved.