I am debugging a string variable in Visual Studio using the Text Visualizer. However, it seems that a large part in the middle of the string is missing. What is the reason behind this?
The Text Visualizer in Visual Studio can only display about 32,700 characters. If your string is longer than that, it will automatically replaces the excess part in the middle of the string with ...
.
I found this out the hard way.
Edit: this seems to have been fixed in Update 2. If you're on Update 1, see Diamond's answer.
This is an issue that was introduced with Visual Studio 2015 Update 1 as reported here: https://connect.microsoft.com/VisualStudio/feedback/details/2016177/text-visualizer-misses-corrupts-text-in-long-strings.
Microsoft will have a permanent fix for this in the first update after Update 1. In the meantime, use the following workaround: You can set the length at which the Text Visualizer will truncate by adding a registry key. Use the following command to set the length to a larger number (example 250000):
reg add HKCU\Software\Microsoft\VisualStudio\14.0\Debugger /v TextVisualizerStringLimit /t REG_DWORD /d [number]
Alternatively use a previous version of Visual Studio if you have one installed.
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