visual studio – When debugging in VS 2022 DateTime shows {System.DateTime} on mouseover


I am using Visual Studio 2022 Professional. version 17.9.0.

For some time I have seen that when I am debugging, and want to see what date a DateTime variable is set to, it only shows “{System.DateTime}” and not the actual date.

enter image description here

It’s the same in the watch windows.

enter image description here

This (someone else’s) question was solved by removing a pin on the Kind property of DateTime: Showing DateTime .ToString() in debug VS 2022

But I don’t have any pinned properties on my DateTime. If there was a Type-property I would guess it could be pinned but it does not show up in the watch window when I look at DateTime.Now.

I also have enabled the “Call string-conversion function on objects in variable windows” setting.

In the Watch window, when I use the “ToString()” function on my variable, it shows the date as I would expect. Why is VS not calling the string conversion function implicitly?

I am using a workaround which is to pin the Year, Month and Day. But it’s a little bit more cumbersome to read.

Some of my colleagues have the same problem.

So any suggestions on how to solve this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *