Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Sunday, 3 December 2017

How To Call A Method When Visual Studio 2015 debugger hits?

 guruji point, Gurujipoint, Technology News, Visual Studio 2013, Visual Studio 2015     1 comment   

How to call a method when Visual Studio 2015 debugger hits? (www.kunal-chowdhury.com)
Debugging a piece of code is always difficult and it is more difficult when you are debugging on someone else’s code. In all such cases, you will need to set the breakpoints and check the values that it returns before proceeding next.

Visual Studio 2015 makes it easier by providing you an option to call a specific method once you reach the breakpoint and based on requirement, print something on the output stream.

Maintain state of dynamic added userConrol 
Today we are going to learn about Visual Studio 2015 debugging tips and the way to handle breakpoints with enhanced practices. We will learn how to call a method when the debugger in Visual Studio 2015 hits.

To demonstrate this, let us create a new console project and write a method “PrintMessage” having no parameters. The method will just print a line in the console output. Now inside the Main method, add a breakpoint and open the breakpoint settings as shown below:

1. Open breakpoint settings in Visual Studio 2015 (www.kunal-chowdhury.com)

The breakpoint settings tab will have two checkboxes labelled “Conditions” and “Actions”. For our demonstration, check the box labelled “Actions”. This will provide you an input box to enter the log message. This box also accepts members as input and can be written inside “{  }” braces.

2. Create custom action for breakpoint in Visual Studio 2015 (www.kunal-chowdhury.com)


Here we are going to call the PrintMessage method when the breakpoint hits. So, call the method inside the curly braces. The intellisense will show you a list will all the available options based on the context of what you are typing.

3. Call predefined method on breakpoint actions in Visual Studio 2015 (www.kunal-chowdhury.com)


This will look like the below screenshot. As the method does not accept any parameter, keep the call as-is and click on the close button. Now when you run the program in debug mode and hit that breakpoint, it will call the said method automatically. Check the “Continue execution” to continue with the next calls even though the breakpoint hits.

4. Call a method when a breakpoint hits in Visual Studio 2015 (www.kunal-chowdhury.com)


Have a look into the symbol of the breakpoint. In general the breakpoint symbol is set to circle but when you set the action for the breakpoint, it changes it’s shape to diamond.

You can also call the method passing some value to it as parameter. For example, let us pass an integer value to the “PrintMessage” method. Change the signature of the method and go to the breakpoint settings as shown in the below screenshot:

5. Open the breakpoint settings in Visual Studio 2015 (www.kunal-chowdhury.com)

What is WebAPI and why do we need API's

Now in the breakpoint settings, under the “Actions” panel, change the method call and pass the desired value. To demonstrate it, we passed the integer value ‘x’ as shown below. Click enter to accept the changes and click close to hide the settings page.

6. Passing a parameter to method when breakpoint hits in Visual Studio 2015 (www.kunal-chowdhury.com)

Now when you run the program and hit the breakpoint, the same method will be called passing the value as the parameter, which you can use inside the method as per your need.

 Removing duplicate records from SQL Table

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to TwitterShare to Facebook
Newer Post Older Post Home

1 comment:

  1. for ict 991 August 2020 at 22:38

    The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Projects for CSE.

    Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

    Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete
    Replies
      Reply
Add comment
Load more...

Facebook Updates

Guruji Point

Categories

comma seperated string in sql Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS row_number() and dense_rank() salary table structure. Scope_Identity() Use of indexes while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write