When debugging XML, it's a pain the butt to constantly click on the Text/XML visualizers in the Watch Window to see the full value of an XML string variable. The "Watch" windows in Visual Studio seem to be constrained to one line.
Is there a way to constantly "watch" the value of a multi-line variable when debugging? Doesn't have to be in a watch window i suppose, but I want to see the value of an XML string, and the visualizer boxes are modal.
It's not very pretty, but one way I have dealt with that is to put the string address in a memory window, which can show text characters. Open one of the memory windows from the Debug menu: Debug\Windows\Memory. You can then type in the address or the variable name or just double click on the variable and "drag" it up to the address field of the memory window.
What you could do is change the autoexp.dat so it will display the hash of the string first, so at least you know when the string changes. That way you don't need to open the visualizer box as often. Of course this will not work when the multi-line string is continually being updated.
I know this question is asking about Visual Studio 2010, but in Visual Studio 2013, you can right-click on the string variable row in the Autos/Locals/Watch pane and select Add Parallel Watch. This will give you a non-modal, multi-line view of the string variable value.
Related
In Visual Studio 2010 if you had a very long string with multiple lines, you could hover over the variable and click on the magnifying glass icon:
This would bring up a little window called "Text-Schnellansicht" in german, so probably something like "Text quick watch" in english:
This way you could quickly understand the content of a complicated string variable.
In Visual Studio 2019 I can't find this window anywhere. There's no magnifying glass icon in the tooltip-thingie. Closest thing I could find was right-clicking on that, selecting "Copy value" and pasting it into notepad or some other editor.
So... is it just gone, along with all the other useful features that got removed throughout the years? Or was it just buried deep enough so that no one would find it?
Edit:
The epic tale of "How can we make our flagship IDE more painful to use?" continues:
Back in the good'ol days you could have this window for any variable you want:
Click on the hourglass, see what you got.
2019:
It only works for actual String variables. Because no other type could possibly have a string-representation that long, right?
The string visualizer is still there for me in VS 2019:
Documentation also suggests that it should be available https://learn.microsoft.com/en-us/visualstudio/debugger/string-visualizer-dialog-box?view=vs-2019
The Watch window in Visual Studio displays dates in the format "#3/5/2014 12:00:19 AM#"
I need to see milliseconds. How do I change or override the default format string in the Visual Studio IDE?
I have tried changing the Windows system regional settings, however there does not appear to be a format string for milliseconds (and I'm not sure if VS uses this anyway).
Your best bet is probably to add a separate line on the watch window that shows the milliseconds of the variable. In .NET for instance, System.DateTime has a Milliseconds property, so your watch window would contain
myDate
myDate.Milliseconds
You can also add an expression in the watch window that includes the format you want, such as myDate.ToString("mm:hh:ss.ffff") in .NET. However, methods have to be re-evaluated whenever they change.
There isn't an easy way to change the default way the debugger displays values without writing a visualizer plugin for Visual Studio. However, if it is your own type and you are using .NET, then you can override ToString() or add a DebuggerDisplay attribute.
You can also follow the technique in https://binary-stuff.com/post/introduction-to-dotnet-pretty (about halfway down, under the heading DotNet Pretty's first contribution) to easily create a custom visualizer for a built-in type.
My Visual Studio extension, is arranging Tab Sizes using ITextParagraphPropertiesFactoryService interface. That class is doing a great job, and helps me to set tab widths for all existing lines, but I have a problem to set tab sizes for new virtual line.
In other words, Visual Studio is setting caret position in VirtualSnapshotPoint, and converting it to real tabs only when user enters some symbols.
Now, Is it possible to force Visual Studio to create real tabs instead of virtual spaces? I try to create edit on view, and insert real '\t' symbols, but VS still converts it back to virtual... This happen for both, block and smart indent tab settings
So the behavior of blank lines being virtual space only is by design, and as best I know not changeable. If there's a specific problem with it, please update the question and we can go from there.
I'm using Visual Studio 2008 and I have just noticed that the debugger is displaying integer values as Hex when I hover over variables and also in the immediate window. I guess I must have hit a shortcut key accidently or something.
Anyone had this before? How do I set it back to display in decimal?
Right-click your Watch Window or Immediate Window and uncheck Hexadecimal Display option.
You can also choose hexadecimal or decimal display on a per-variable basis in the Visual Studio watch window by appending a debugger format specifier to the variable name. In the watch window, enter:
myInt,h
myInt,d
The other very useful format specifiers are ac (see footnote) for 'always calculate', and nq for displaying with 'no quotes.' They can be used together:
my_string_func(),ac,nq
nq is useful inside DebuggerDisplay attributes, which can appear on a class:
[DebuggerDisplay("{my_string_func(),nq}")]
class MyClass
{
/* ...example continues below... */
...or on one or more field(s) inside a class:
[DebuggerDisplay("{some_field,nq}", Name="substitute name here")]
int an_integer;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
String some_field;
}
http://msdn.microsoft.com/en-us/library/e514eeby(v=VS.100).aspx
note that earlier versions of the MSDN doc page incorrectly said 'Ac' (with a capital 'A')--which doesn't work
There is a Hex button shown when Visual Studio is run in Debug mode to enable/disable the Hex display
Right-click on client space of almost every debug window (except Immediate Window) - watch/locals/autos/threads/call stack - and uncheck "Hexadecimal Display" option.
There's also a "Hex" button in debug toolbar (right to "Step Over" by default) when debugging.
In Visual Studio 2010 I also saw it in the Debug toolbar, it was highlighted in yellow 'Hex', I just clicked it and it returned to (normal) decimal values
Visual Studio 2017
Decimal vs. hexadecimal display is controlled only from the Watch dialog.
Break after setting the variable.
Right mouse click the variable and select "Add Watch" or "QuickWatch"
Right mouse click the line in the Watch dialogue.
Uncheck "Hexadecimal Display"
The display will now be in decimal.
In the immediate window you can uncheck the Hexadecimal Display option.
ViM has this option hlsearch where a searched string is displayed in highlight mode at all places in the file it is found. Is there a way to do the same in Visual Studio?
That is, if I search for "foobar", then all the foobar in the file are shown highlighted and this display remains until my next search. I find this very useful to see the places in a function where a certain variable is used (without having to manually search for the next appearance of that string).
I am aware of the Visual Studio Task List which can be used to look up strings like TODO. I hope the reader realizes that this is not a good fit for my problem which is more general text search and highlight.
If you like vim and are using Visual Studio you may want to check out Viemu.
The hlsearch Feature is of course included.
Example Picture:
Viemu hlsearch http://dklein.taunus.de/viemuhlsearch.png
With best regards.
Visual Assist X does this, along with something akin to light-symbol-mode. Among other things, of course.
Visual Studio 2010 now supports Reference Highlighting. Click on or move the cursor to any symbol such as names of variables, classes, methods, properties, etc. and it will highlight all other references in the file. It also allows you to navigate between the references using:
ctrl+shift+down arrow or ctrl+shift+up arrow
I use the RockScroll add-in. It has multiple features, one of them is that if you double click on a word it will be highlighted everywhere in the file. This is very similar to what you describe. It is free (as in beer).
If you happen to really like Vim, you might want to look into ViEmu for Visual Studio . I'm just a really happy user of it :)