Custom Debug Visualizer - For C# Stack

Creating Custom Debug Visualizer in C#

Debug Visualizers are visual studio IDE’s debugging component. These components represent the variables and class objects in meaningful form so that it can be easily visualised. Say; for example, you have class ABC to store the “Passport Size” photo of a person and using the visualizer you can see the photo of the person while debugging the object of ABC. In this example, we will create our own visualizer to see the Stack data structure. You can use the technique explained here with any objects.

The Item marked as 1 show five elements pushed into the Stack object of the Dot Net Framework. Item marked as two shows the Visual studio debugger showing the Visualizer written by us. If we write multiple visualizers for the same Stack object, C# debugger lists them all here. Moreover, we can mention the default one by placing the check mark. Clicking the lens icon invokes that default visualizer. The item marked as three shows the simple stack debug visualizer which lists all the current items in the stack. Left is the Top of the Stack and right is the bottom of the stack.

Debugging Attributes C# Example

C# Debugger Attributes Explained

In the last example, we saw about Logging and getting function call stack data. In this article, we will see about Debugger Attributes which controls debugging behavior of the objects and gives a rich experience to the debugging user. An Attribute is a Tag set over the elements like Class, Functions, assemblies, etc. These tags work out how the elements should act at run time. Let us see below specified debugging attributes with a simple example:

DebuggerBrowsable Attribute
DebuggerDisplay Attribute
DebuggerHidden Attribute

Debugging Technique Part1 - Example

Debugging Using C# System.Diagnostics

The text box marked as 1, shows the status of the debugger. When we attach the application with the debugger, the status shows Attached. Clicking the Refresh button (Marked as 2) updates the debugger status. Clicking the Break on Code button (Marked as 3) dynamically breaks the application as breakpoint is hit. This is useful when you want to break the application without the manual insertion of breakpoints. When we click the Debug Log (marked as 4) button, the example produces the log entries in the debug output window. In the same debug output window, we print the application call stack whenever user clicks the Output Stack Trace button (Marked as 5).

Basic Java Training Video Course For Beginners

In this video series, you will learn java language basics. This playlist talks about language fundamentals and concepts. Here we will not dig into JAVA SDK and API. We will learn it in a separate video series. We would suggest learning java language before going to the JAVA SDK. This series is having 6 hours of learning.

MasterPage Example

ASP.Net Master Page Example

Master Pages help in providing the consistently laid-out pages. When we switch between other pages, we can note the steady look and feel throughout the websites. Microsoft provides Master Page support from ASP.Net 2.0 onward. The Master Page is used to making the outer skeleton structure of the websites and we can see this outer skeleton as web page header, footer and sidebars with navigational elements. In this example, we will explore how to create a Master page along with other web pages.