dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.88k stars 783 forks source link

The "dict" debugger visualizer is useless #3981

Closed 0x53A closed 6 years ago

0x53A commented 6 years ago

grafik

grafik

vasily-kirichenko commented 6 years ago

Turning on this setting

image

makes it more usable

image

vasily-kirichenko commented 6 years ago

However

image

@KevinRansom @TIHan We should think about providing "modern" (whatever it means) visualizers for lists, dicts and maps.

cartermp commented 6 years ago

Lists, arrays, and maps use the same visualization behavior in the legacy EE thanks to @saul:

works

Is the suggestion that the underlying IDictionary's keys and values be ToArray'd? Today it shows it as the underlying IEnumerable, which you must enumerate in the DataTip.

0x53A commented 6 years ago

Note: I am using the latest VS preview WITHOUT nightlies, so some of this may already be fixed.


ah, right, there was that switch ... If I enable the legacy EE, I get empty "Autos" / "Locals", and trying to manually add something to the watch: grafik

grafik


If I also enable managed compatibility mode, then I get grafik

grafik

(Which is probably because this is a new-sdk console app, so portable-pdb).


IF I then also disable portable-pdb I see this: grafik

So there is no way to drill into Keys, but I can drill into Values. The fact alone that I can't actually see the keys makes this really useless.



Compare this with C#:

grafik

I see the total count at the top, instead of the type which I don't care about.

If I open it, I see ToString for each key/value combination, and can drill down.

saul commented 6 years ago

Looking at the code, we just don't have a debug visualizer for the result of 'dict'. Will take a look at adding this an put in a PR.

0x53A commented 6 years ago

Should I create a separate issue for the following, or is this already on your radar?

1) Legacy EE only works in combination with Managed Compat Mode (otherwise I get "Internal error in the expression evaluator") 2) Managed Compat Mode does NOT work in combination with portable-pdb

==> portable-pdb and sane debugging are exclusive

cartermp commented 6 years ago

The legacy EE is very unlikely to change in the future, nor do I suspect we'll be doing much work in portable PDB generation to ensure it works with an EE that will be discontinued. With @saul's PR (if you can confirm it works), what else is missing such that it's "sane"?

KevinRansom commented 6 years ago

The Legacy EE is deprecated. We need to build an F# EE it's a piece of work, and is on the backlog. In the meantime we leverage C#'s EE.

0x53A commented 6 years ago

Ah, apologies.

I was under the mistaken impression that the List, Set, Map (and so on) visualizers also only worked with legacy EE.

After actually testing it, it works really good with new EE and portable-pdb. 👍

The only really minor thing I noticed is that it writes the type of the key as System.__Canon {string} instead of just string.

grafik