Strings in debugger are truncated in fields but not in the parent objects toString() representation #4986
Copy link
Copy link
Closed
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Description
The image shows the variable in watch, console, local debugger, and tooltip.
"Copy value" shows:
"/Users/benjaminfarquhar/Library/Developer/CoreSimulator/Devices/F56DA440-80AE-494E-A141-4EB263A9FF4F/data/Containers/Data/Applic…"
Interestingly, the grey text in the debug variables is not truncated. So you can see the whole value if you hover over file.value, it shows the File which seems to contain the path inline inside the File. But I think if the variable was a primitive String (not a String within a File) it would be impossible to see the whole value.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in debuggingRelates to the debug adapter or process of running debug sessionsRelates to the debug adapter or process of running debug sessionsis bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Activity
DanTup commentedon Feb 15, 2024
Turns out, this was fixed more recently than I remembered and hasn't made it to a stable release yet:
dart-lang/sdk@5929460
I tested on Flutter stable and it's truncated, but on beta it's not.
Hmm, that might be a bug. Generally in this view we are given truncated strings by the VM Service. We don't normally expand them except in the REPL/Debug Console and Copy Value because in a large object, there could be a lot of large strings.
However, we to (by default) call
toString()on complex objects, and I wonder if that's bypassing the truncation. I'll take a look because this should be consistent.When the current beta goes stable, Copy Value should work as you expect though.
[-]Variable in debugger is truncated everywhere with ellipses.[/-][+]Strings in debugger are truncated in fields but not in the parent objects toString() representation[/+]DanTup commentedon Feb 15, 2024
I've renamed this issue and will use it to track the inconsistency noted above (the fix may be for the grey text to also be truncated).
[dds/dap] Don't untruncate toString() values in debug views
DanTup commentedon Apr 24, 2024
This is fixed (that is, we will consistently use truncated values unless you're in the REPL or using "Copy Value") by dart-lang/sdk@2f2564c. The fix is in the SDK debug adapters so will ship in a future SDK release.