Debugging Techniques for ASP.NET Applications

chapter 5 how to test and debug chapter n.w
1 / 19
Embed
Share

Learn how to effectively test and debug your ASP.NET applications, including working in break mode, controlling execution, monitoring variables, using data tips, and more to streamline your development process.

  • Debugging
  • ASP.NET
  • Testing
  • Break Mode
  • Variables

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CHAPTER 5: HOW TO TEST AND DEBUG CHAPTER 5: HOW TO TEST AND DEBUG AN ASP.NET APPLICATION AN ASP.NET APPLICATION #10 AJAY KUMAR GADAMSETTY p:170-185

  2. Overview Overview How to work in break mode How to control the execution of an application How to use the Autos, Locals, and Watch windows to monitor variables How to use the Immediate window to work with values How to use the Trace feature

  3. How to work in break mode How to work in break mode Shopping Cart application in break mode Shopping Cart application in break mode

  4. When you enter break mode, the debugger highlights the next statement to be executed. To display the value of a variable or property in a data tip, position the , mouse pointer over the variable or property in the Code Editor window. To display the members of an array, structure, or object in a data tip, position the mouse pointer over it to display its data tip, and then point to the plus sign in the data tip.

  5. To change the value of a property or variable using a data tip, click on the value in the data tip and then enter the new value. You can use the icons to the right of a data tip to pin the data tip so it remains displayed, to unpin the data tip so it floats on top of all other open windows, to add, display, and hide the comment for a data tip, and to close the data tip. To continue program execution, press F5 or click the Continue button in the Standard or Debug toplbar. For more on controlling program execution.

  6. How to control the execution How to control the execution of an application of an application Commands in the debug menu and toolbar Commands in the debug menu and toolbar Commands in the Code Editor window s shortcut menu Commands in the Code Editor window s shortcut menu

  7. Once the application enters break mode, you can use the Step Step Into, Into, Step Step Over, Run Run To To Cursor Cursor commands to execute one or more statements and return to break mode. Over, Step Step Out Out, and To alter the normal execution sequence of the application, you can use the Set Statement Statement command. Set Next Next To stop an application that's caught in a loop, switch to the Visual Studio window and use the Debug Debug- - Break Break All All command.

  8. How to use the Autos, Locals, and How to use the Autos, Locals, and Watch windows to monitor variables Watch windows to monitor variables

  9. The Autos variables in the current statement and the previous statement. Autos window displays information about The Locals variables within the scope of the current method. Locals window displays information about the The Watch variables and expressions you specify, called watch expressions. You can display up to four Watch windows. Watch windows let you view the values of

  10. To delete a row from a Watch row and choose Delete Watch window, right-click the Delete Watch Watch. To display any of these windows, click on its tab if it's visible or select the appropriate command from the Debug-*Windows menu. To change the value of a property or variable from any of these windows, double-click on the value in the Value Value column, then type a new value and press the Enter key.

  11. How to use the How to use the Immediatewindow Immediatewindow to work with values to work with values The Immediate window The Immediate window You can use the Immediate window to display and assign values from a program during execution. To display this window, click on the Immediate Window tab or use the following command. Debug Debug- - Windows Windows- - Immediate Immediate

  12. To display a value in the Immediate question mark followed by the expression whose value you want to display. Then, press the Enter key. Immediate window window, enter a To execute a method from the Immediate its name and any arguments it requires. Then, press the Enter key. Immediate window window, enter To reissue a command, use the Up keys to scroll through the commands until you find the one you want. Up and Down Down arrow To remove all commands and output from the Immediate window, use the Clear shortcut menu for the window. Clear All All command in the

  13. How to use the Trace feature How to use the Trace feature The beginning of the trace output for the Cart page The beginning of the trace output for the Cart page

  14. The session and cookies information for the Cart page The session and cookies information for the Cart page A Page directive that enables tracing for the Cart page A Page directive that enables tracing for the Cart page <%@ Page Languages"C#" AutoEventWireup="true" CodeFile="Cart.aspx.cs" Inherits="Cart" Trace="true" Trace="true" %>

  15. The ASP.NET Trace feature traces the execution of a page and displays trace information and other information at the bottom of that page. To activate the trace feature for a page, you add a Trace attribute to the Page directive at the top of the aspx file for the page and set its value to True as shown above. True The trace information is divided into several tables that provide specific types of trace Information.

  16. How to create custom trace How to create custom trace messages messages Common members of the Common members of the TraceContext TraceContext class class Code that writes a custom trace message Code that writes a custom trace message if (Trace.IsEnabled) { Trace. Wr i te ("Page_Load", "Binding products drop-down list."); }

  17. You can use the TraceContext own messages to the trace output. The TraceContext object is available through the Trace property of a page. TraceContext object to write your Trace Use the Write message. Use the Warn message in red type. Write method to write a basic text Warn method to write a Trace messages are written only if tracing is enabled for the page. To determine whether tracing is enabled, you use the IsEnabled of the TraceContext object. IsEnabled property

  18. Thank you Thank you

  19. Queries??? Queries???

Related


More Related Content