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.
Related
Does anyone here happen to know if the flag that appears in the title bar of visual studio to alert users of new notifications (see the illustration below) is part of a font family (ie along the lines of wingdings) which gives it that blue roll over effect when one rolls one's mouse over it.
I have been experimenting with adding additional buttons to the Title Bar (I'm using Actipro's RibbonWindow and adjusting the WindowChrome) and I can see that using text with a certain style added will give the correct effect. Now I'm just trying to establish if the flag symbol that is used in visual studio is readily available and if so where. For example I know that using a capital o as the content of a button and setting the font to Wingdings will produce a flag, but not the one that Visual Studio uses.
No, it is a path. In VS 2015 it is defined as "F1M14,0L0,0 7,14 9,14 6,8 14,0 14,0z M11.586,1L5.293,7.293 4.94,7.645 1.618,1 11.586,1"
I'm creating a custom project type in Visual Studio; and currently all icons appear as placeholders. There are properties that Visual Studio requests that allow me to define the icons (_VSHPROPID Enumeration)
__VSHPROPID.VSHPROPID_IconImgList:
__VSHPROPID.VSHPROPID_IconHandle:
__VSHPROPID.VSHPROPID_IconIndex:
In the MPF sample from Microsoft; they return the same values as me (null) for the above properties, yet the default icons (eg. .cs) appear correctly!
I've spent many hours trying to strip MPF down (it's enourmous; with many tens of thousands of lines of code) but it either continues to work; or I remove something that causes it to fail to create the new project without a useful error/stack.
It seems that in addition to implemented IVsHierarchy, you need to implement the GetAutomationObjects and return ProjectItems too.
That's how MPF and some others do it, anyway. I was unable to make it work, so I'm giving up!
Summary: Is there an easy way to save alternate command arguments used by the Visual Studio debugger?
Details:
Visual Studio has an option to set Command Argument that are used by the debugger. For example in the screenshot shown here I've set them to FOO BAR. Sometimes when debugging a project I want to switch the arguments to test different input sets. And often the arguments are much longer than just FOO BAR. It would be nice if there was a way to save the arguments that I've typed and switch between them quickly. Ideally it would also be possible to change the working directory at the same time. But I haven't found a way to do this yet so that's why I'm asking here. I'm using Visual Studio Professional 2012.
You can just create new configuration(s) for this project. I see that your current active configuration is Debug (top left corner of project settings dialog). You can create new configuration(s), which will be based on this one, and name them like Debug-Test1, Debug-Test2, etc. After you will do this you will have a choice to switch between this configurations in VS Debug Toolbar.
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.
I want to be able to modify a certain setting of Visual Studio right from the toolbar.
Specifically, the number of parallel builds (Tools | Options | Projects and Solutions | Build and Run | maximum number of parallel project builds).
It can be either an edit box right on the toolbar or two buttons setting it to certain values.
I use Visual Studio 2005.
Any suggestions?
Write macros which will modify the two settings, then put macro on toolbar using "Cusomtize"
(almost) any VS command or property has a corresponding scriptable object that you can call in macros.
Do Alt-F11, go into the macro editor, open the object model window and start sniffing around. You can use search to look for the relevant class/function for a given property (e.g. the number of builds). Once you find it, it's just a matter of writing a few VBA lines that change it and, as Ilya suggested, put that macro in your toolbar.
Btw, it should be possible to put an edit box in the toolbar to get the value; but it would probably be much easier just to call InputBox or something to ask the user for the input.