17

I'm debugging a C++ application with VS2008 and with some long select queries I'm not able to see the full text in the debugger. It just shows a part of the query.

Is there a way to see the full text?

Thanks in advance.

enter image description here

EDIT: The real query available at the string is:

select  c.cd_seq, m.diag_code, m.diag_descr, 'S' as source 
from custom_booking_data c 
left outer join meddiagnosis m 
on c.cd_number_value = convert( decimal( 28, 8 ), m.diag_urn ) 
where c.custom_data_urn = 4 and c.cd_field = 433 
union 
select  c.cd_seq, m.diag_code, m.diag_descr, 'H' as source 
from custom_booking_data c 
left outer join ordiagnosis m 
on c.cd_number_value = convert( decimal( 28, 8 ), m.diag_urn ) 
where c.custom_data_urn = 4 and c.cd_field = 594

Not that long if you ask me.

Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
  • How long are we talking here? I've viewed stuff that was 10,000-20,000 characters long without truncation. In your case it looks like it's in an ATL::CString. Does that have the correct length? Perhaps the string is actually truncated. – Adrian McCarthy Mar 22 '11 at 16:49
  • 2
    Click the text visualizer icon, looks like a spyglass. If that still clips, definitely consider simplifying your queries. – Hans Passant Mar 22 '11 at 16:56
  • Its a string of about 1.000 characters and yes, it's an ATL:CString. How to check if it has the correct length? I know the full query its there because it gets executed and the expected results are retrieved. – Ignacio Soler Garcia Mar 22 '11 at 16:58
  • 4
    Same here with VS2015 Update 1: string truncated to 32768 (or more specifically: the first 16382 characters followed by "..." followed by the final 16383 characters). Any solutions? – D.R. Dec 04 '15 at 17:32
  • 1
    @D.R. - I have encountered the same 32768 character problem, also using VS2015.1. Can easily be reproduced with `new string(' ', 32769)`. I've looked around and haven't found any other question anywhere that mentions this. Visual Studio 2013 is fine with it and shows the whole string. – Wai Ha Lee Dec 10 '15 at 11:34
  • 5
    Funny update: VS 2015 has no problems -> VS 2015 Update 1 introduces the problem. Workaround: `File.WriteAllText(@"C:\Temp\temp.txt", str)` in the immediate window. – D.R. Jan 05 '16 at 08:56

5 Answers5

16

Hover the variable you want to view, then click on the magnifier icon following icon, or select the arrow right to the icon and select Text from the drop down menu

enter image description here

This is the result, i think you asked this...

enter image description here

Sameera Kumarasingha
  • 2,908
  • 3
  • 25
  • 41
  • 3
    Indeed, does not help with strings longer than 32768 characters. – D.R. Dec 04 '15 at 17:36
  • It seems that VS2015 can show longer than 32K characters on this form. There should still be a limit, but at least it's higher than that. – ScottRhee Nov 10 '17 at 01:14
  • In VisualStudio 2017 there seems to be a limit of a little bit more than 1 million characters (char). – Sascha Aug 08 '18 at 09:04
3

This seems to be a 'feature' in Visual Studio. I see the same thing in VS2012 using C#, with a string that is just over 500 characters.

The solution that I found was to right click on the variable in the debugger and do a 'Quick Watch' on it. The string is not truncated in the Quick Watch window.

Brad Oestreicher
  • 1,161
  • 8
  • 10
1

This is in a comment but really is the answer I was looking for: File.WriteAllText(@"C:\Temp\temp.txt", str)

Yahya Hussein
  • 8,767
  • 15
  • 58
  • 114
1

Could it be that your string contains NUL '\0' values? Textbox controls like the ones the debugger is using will interpret them as the end of the string.

codymanix
  • 28,510
  • 21
  • 92
  • 151
0

I think you can right-click the item and then 'copy to clipboard'. Then paste it into another text editor.

Javi R
  • 2,320
  • 1
  • 17
  • 21