(For reproduction instruction see Update II)
I recently messed around with Visual Studio 2019 during a debugging session. I pinned some properties of the class "SqlCommand" as "Favorites". Since that moment I receive an error message "internal error retrieving local value" in the "locals".
There is a "refresh" button on the right of the value column, and when I hit it, I get the message "Internal error in the expression evaluator."
Now I am not able to unpin that specific property, because the class tree can not be opened anymore.
This behavior is not bound to a specific solution, I created a new demo solution where I have the exact same issue.
You can see it in the below screenshot:

The main goal would be to somehow clear the information of which property of the classes are pinned in the "locals" window.
I already tried several things to get rid of the error.
I use Windows Server 2019 Standard, .Net Framework 4.7.2, Visual Studio 2019 16.7.6
I use the following code in the demo application:
private static int Main(string[] args)
{
SqlConnection conn = new SqlConnection();
SqlCommand cmd = new SqlCommand();
return 0;
}
This is the pinning feature i'm talking about. I show it on the example of the WorkstationId property of the SqlConnection object (because it on the SqlCommand it does not work anymore). I believe I used it on the command text and the parameters property. The pinnable property is a relatively new feature introduced with 16.4

There is a file called ObjectFavorites.json in the folder:
%USER%/Documents/Visual Studio 2019/Visualizers
It has the following contents:
{
"$schema": "https://aka.ms/vs/debugger-managed-favorites-schema",
"types": {
"System.Data.SqlClient.SqlCommand": {
"favorites": [
"Parameters"
]
}
}
}
Delete the line "Parameters".
You don't even have to stop or restart VS, you can edit this file on the fly. Start the debugger again after you have removed the line and the error will be gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With