In this tips I have explained how you can automatically wrap up code blocks or code statement in Visual Studio. We can use Document formatting to format the whole contents, but that doesn’t wrap single line code block like Properties or not even single line multiple declaration statement. Let’s consider an example, you are creating a Properties using code snippet and by default it will came up like
But, you want you code to be look like as below
How ? Read Complete Tips
One of the common tasks involved in the development is GUID’s generation. This is even more frequent when we are working on a SharePoint solutions. Even during writing unit test we need to generate static GUID to validate data’s. Visual Studio comes with a tool called guidgen.exe ( c:\program files (x86)\microsoft sdks\windows\v7.0a\bin\NETFX 4.0 Tools\guidgen.exe ) which is registered with visual studio as an external tool and invoked from Tools > Create GUID. But whenever you need an unique static GUID you have to navigate to tool and copy the ID evertime. Last few days of my development involved with lots of GUID generation where I found it’s taking time to generate so many guid’s. So, I came up with an small approach where we can generate a GUID by just pressing some shortcut key. Behind the seen I wrote a macro for the same and that is being triggered with the key press.
“Use shortcut key to generate GUID very quickly in Visual Studio” Read More
In this blog post I am going to share how you can add a document header of xml comments with code file automatically. This is going to be an very interesting and helpful for all of you who are using styleCop to maintain coding standard. Actually extensive using of StyleCop helped me to think to make it automate. There are many tools available which can helps us in this case to do this automatically. But I always prefer let’s Visual studio do the job for me. Here I am going to share with you two different approaches to deal with this issue. Now it’s up to you which one to use.
“Add document header for files automatically in Visual Studio” Read More
While dealing with maintaining coding standard like stylecop warning fix with code, most of the time we need to remove unused namespaces and sort the namespaces. We can do it easily from the context menu of the code editor. There you have three different option for “Organize Using” . Either you can Remove Unused Usings , Sort Usings or we can do it together by selecting “Remove and Sort” . Let’s see how we can make it more handy !
“Tips : “Remove and Sort” Namespaces using Shortcut in Visual Studio” Read More
Visual Studio having great features to set breakpoint in multiple functions at same time. For most of the time, to set a breakpoint with in a function you just put a breakpoint in the first line of the function. Now, assume you have 10 different overloaded methods or you have same function in different project, and you want to put breakpoint all of them or few of them, then it will take time to put breakpoint in each and every function. In this post I am going to share two quick tips by which you can set breakpoint to function very easily. first one is by using “Break at Function” and second one by “Using Find Combo Box”.
“Tips : Set Breakpoint to multiple Functions at a same time in Visual Studio” Read More
During debugging of your application, you may need to keep track of some data which are already out of scope. Say, You call a MethodB() from MethodA() and did some operation inside MethodB(), now when you returned back to MethodA(), all the local variables inside MethodB() are out of scope. But you want to use them in MethodA(). Now here is the trick, that you can create an ObjectID for an member variables or objects and can track the same when it’s out of scope as well, but until GC() does not collect it. In this post, I am going to explore how we can use an Out of Scope object value to deal with Conditional Break points. To start with, first you have to understand how to use Object ID to track and out of scope object. Here is my complete article How to track an object which is Out of Scope while Debugging ? . Though I described a quick look into use of out of scope object inside conditional breakpoints on that article, I received few query about more details on the same. So here I am going to give some more details.
“How to use out of scope object with in Conditional Breakpoint ?” Read More
“Open Containing Folder” is one of the frequent used functionality to open a particular file location in windows explore from Visual Studio IDE . How did we do that ? Yes it’s very simple, Just right click on file from files Tab and select “Open Containing Folder” from the context menu as shown in below.
This will open the selected item location in windows explorer. This operation by default having no keyboard shortcut. But do you know we can assign keyboard shortcut for the same or even we can customize the context menu in code editor to achieve the same as shown in below images.
“Use Shortcut or Context Menu for “Open Containing Folder” in Visual Studio” Read More
In one of my previous blog post, Identifying Worker Process (w3wp.exe) – IIS 6.0 and IIS 7.0 for Debugging ASP.NET Application – I have explained about how we can identify the list of currently running worker process using command prompt while we need to attach process from visual studio . But do you know for IIS 7.0 and IIS 7.5 we can get the worker process (w3wp.exe) details like Application Pool name, Process ID, CPU Usages from IIS Manager itself. Even you can get details of each worker process for a “Web Garden” scenarios. So when you need to attach some process for debugging from Visual studio, Instead of going to command prompt, you can easily identify the worker process Id from IIS itself.
“How to use IIS Manager to get Worker Processes (w3wp.exe) details information ?” Read More
Most of the time we use Visual Studio find combo box ( ) only for search contents with in the solution. But the find combo box is something more than what we know. We can use the find combo box in different purpose like create file, open files, create project, print, open watch windows etc. As for example you can close all the open files by just typing “>CloseAll” with in find combo box followed by a “Enter”. Fundamentally we can execute all the commands from Find Combo box which are available from Visual Studio Command Window. Like Command Window, In Combo Box, if you type “>” and aliases and press enter result will be the same.
“Multipurpose Find Combo Box in Visual Studio” Read More
Watch windows is one of most commonly used debugging tool with Visual Studio. We generally used to explore the objects, values, properties and other nested objects as a tree structure. Most of the time we used watch window to only view the values or change the current object properties values to see the effects of changed object during debugging. But we can use watch windows for many different purposes. In this blog post I am going to show 10 Tips, that may help you while dealing with Watch Window.
“10 Tips you should know about “Watch Window” While debugging in Visual Studio” Read More
In Mastering in Visual Studio 2010 Debugging article I have discussed about the basic of Object ID creation while debugging. I received some request from some readers to explain the use of “Make Object ID” in details. In this blog post I am going explain how we can track an Object which is already out of scope using by creating a Object ID while debugging.
By using “Make Object ID” option we are informing Visual Studio Debugger to keep track of that object no matter it’s within scope or out of scope for the current context. We can create “Object ID” either from Locals, Autos or from Watch Windows. Object ID is a integer number followed by a pound (#) sign. When we create Object ID for an particular object, Visual Studio Debugger ( CLR Debugging Services ) use an integer value to uniquely identify the object. This “Object ID” allows you to get the object details even if it is out of scope.
“How to track an object which is Out of Scope while Debugging ?” Read More
In this blog post I am going to explain how you can customize the complete view of the debugging window during debugging of application. By complete view means, where you can add own Properties, can customize the result, manipulate the data, hide properties which may not need during debugging etc. In one of my previous blog post, I have explained how we can customize the view of the debugging windows using DebuggerBrowseable and DebuggerDisplay attributes over Few Tips on Customizing Debugging Window View in Visual Studio . But, both these two attributes are limited to customize the view for a specific class and they can only show you the information for the particular class members . In this blog post you will see how we can create new view for some existing debugging view using “DebuggerTypeProxy” attributes. From the below snaps you can understand what kind of customization we can do inside a debugging window.
“Customize the Debugging Windows : Change Debugging Window View as per your requirements” Read More
ASP.NET Tree view control rendered as HTML Table – TR –TD elements. Each of the node are been represented as hyperlinks. Some times you may not want that fields as hyperlink and you want to be those nodes should be represent as static text. Many of the developer did the same using font style or css style change of the node, but it can be done very easily. In this small blog post I am going to describe how you can represent a tree view node as simple text instead of hyperlink.
This can be done very easily using Tree Nodes, SelectionAction properties. SelectionAction having 4 different values, they are.
Select is the default option which marked node as hyperlinked and on selection of the node, it raised SelectedNodeChanged event. For Expand Option, TreeNodeExpanded event will be raised while expanding the node. “SelectExpand” raised both the SelectedNodeChanged and TreeNodeExpanded events. Now if you don’t want to make the node as simple text, just change the SelectionAction properties to “None”.
“How to remove Hyperlink from ASP.NET TreeView Control Nodes ?” Read More
“Track Change” one of the best interesting features in visual studio which indicates the code changes with a color indicator at the beginning of the line. Generally we know about the two color indicator “Green” and “Yellow” which are used indicting the color change till VS 2008 along with those VS 2010 introduced another new color “Orange” which indicates some additional track change for undoing file after save. In this blog post I am going to explain how those color indicator helps developers to track the code changes.
In Visual Studio 2010, there is three color indicator
Green color indicates the lines which you have edited before your last save. Save again the file and green mark will be disappear.
Yellow color indicates the lines which you have edited since the last save of that file. Yellow becomes Green after saving of the file. Once you close the file that indication disappears.
This color indication has newly introduced in VS 2010. This color will come when user does an undo after a save operation for that current file. Orange color indicates that current changed line is different from the saved version of the file.
“Color Indicator for Code Changes – Track Changes in Visual Studio 2010” Read More