SlideShare a Scribd company logo
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 1
Chapter 11
How to
debug an application
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 2
Objectives
Applied
1. Use the debugging techniques presented in this chapter to debug any
unhandled exceptions or logical errors in the applications that you
develop.
Knowledge
1. Describe the differences between the three Step commands that you
can use to control the execution of an application.
2. Describe the primary differences between the Autos window, the
Locals window, and the Watch window.
3. Describe the use of the Immediate window.
4. Describe the call stack that’s displayed in the Call Stack window.
5. Explain how you can use the Console class to display information in
the Output window.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 3
The Options dialog box
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 4
The Exceptions dialog box
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 5
The Future Value application in break mode
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 6
Four ways to enter break mode
• Force an unhandled exception to be thrown.
• Set a breakpoint and run the application.
• Choose the DebugStep Into command or press F11 to begin
debugging at the first line of the application.
• Choose the DebugBreak All command or press Ctrl+Alt+Break
while the application is executing.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 7
The Future Value application with a data tip
displayed
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 8
The Future Value application with a breakpoint
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 9
How to set and clear breakpoints
• To set a breakpoint, click in the margin indicator bar to the left of
a statement. Or, press the F9 key to set a breakpoint at the
insertion point.
• You can set a breakpoint before you run an application or while
the application is in break mode.
• To remove a breakpoint, use either technique for setting a
breakpoint. To remove all breakpoints at once, use the
DebugDelete All Breakpoints command.
• To disable or enable all breakpoints at once, use the
DebugDisable All Breakpoints or DebugEnable All
Breakpoints command.
Express Edition difference
• The Breakpoints window is not available from Visual C# 2010
Express Edition.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 10
Commands in the Debug menu and toolbar
Command Toolbar Keyboard
Start/Continue F5
Break All Ctrl+Alt+Break
Stop Debugging Shift+F5
Restart Ctrl+Shift+F5
Show Next Statement
Step Into F11
Step Over F10
Step Out Shift+F11
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 11
Commands in the Code Editor’s shortcut menu
Command Description
Run to Cursor Execute the application until it reaches the
statement that contains the insertion point.
Set Next Statement Set the statement that contains the insertion
point as the next statement to be executed.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 12
The Locals window
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 13
How to use the Locals window
• The Locals window displays information about the variables
within the current scope.
• To display the Locals window, use the
DebugWindowsLocals command.
• If you are debugging a form and you click on the plus sign to the
left of the this keyword, the properties and variables of the form
are displayed.
• To change the value of a property or variable, double-click on the
value in the Value column, then type a new value and press the
Enter key.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 14
How to use the Autos window
• The Autos window works like the Locals window, but it only
displays information about variables used by the current statement
and the previous statement.
• To display the Autos window, you can use the
DebugWindowsAutos command.
Express Edition difference
• The Autos window isn’t available from the Visual C# 2010
Express Edition.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 15
A Watch window*
*The Express Edition offers just one Watch window named Watch.
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 16
The Immediate window
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 17
The Call Stack window
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 18
The Call Hierarchy window with two methods
displayed
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 19
An Output window that shows debug information
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 20
An Output window that shows build information
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 21
An Output window with debugging information
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 22
Methods of the Console class that write data to the
Output window
Method Description
Write(string) Displays the value of the specified string.
WriteLine(string) Displays the value of the specified string,
followed by a line break.
3 statements that write data to the Output window
Console.WriteLine("Entering CalculateFutureValue method...");
Console.WriteLine("month: " + (i+1));
Console.WriteLine("futureValue: " + futureValue);
Code that uses an if statement to control when
data is written
if ((i+1)%12 == 0) // every 12 months
Console.WriteLine("futureValue: " + futureValue);
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 23
The Visualizer drop-down menu in the Locals window
Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 24
The Text Visualizer dialog box

More Related Content

What's hot

C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slidesC# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slidesC# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slidesC# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slidesC# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slidesC# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-18-slides
C# Tutorial MSM_Murach chapter-18-slidesC# Tutorial MSM_Murach chapter-18-slides
C# Tutorial MSM_Murach chapter-18-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesC# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
Sami Mut
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
Sami Mut
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
Mahmoud Ouf
 
Intake 38 8
Intake 38 8Intake 38 8
Intake 38 8
Mahmoud Ouf
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
Mahmoud Ouf
 
Content
Content Content
Content
o3aroo
 
Oops Quiz
Oops QuizOops Quiz

What's hot (20)

C# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slidesC# Tutorial MSM_Murach chapter-23-slides
C# Tutorial MSM_Murach chapter-23-slides
 
C# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slidesC# Tutorial MSM_Murach chapter-03-slides
C# Tutorial MSM_Murach chapter-03-slides
 
C# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slidesC# Tutorial MSM_Murach chapter-06-slides
C# Tutorial MSM_Murach chapter-06-slides
 
C# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slidesC# Tutorial MSM_Murach chapter-09-slides
C# Tutorial MSM_Murach chapter-09-slides
 
C# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slidesC# Tutorial MSM_Murach chapter-19-slides
C# Tutorial MSM_Murach chapter-19-slides
 
C# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slidesC# Tutorial MSM_Murach chapter-05-slides
C# Tutorial MSM_Murach chapter-05-slides
 
C# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slidesC# Tutorial MSM_Murach chapter-04-slides
C# Tutorial MSM_Murach chapter-04-slides
 
C# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slidesC# Tutorial MSM_Murach chapter-08-slides
C# Tutorial MSM_Murach chapter-08-slides
 
C# Tutorial MSM_Murach chapter-18-slides
C# Tutorial MSM_Murach chapter-18-slidesC# Tutorial MSM_Murach chapter-18-slides
C# Tutorial MSM_Murach chapter-18-slides
 
C# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slidesC# Tutorial MSM_Murach chapter-20-slides
C# Tutorial MSM_Murach chapter-20-slides
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
 
C# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slidesC# Tutorial MSM_Murach chapter-02-slides
C# Tutorial MSM_Murach chapter-02-slides
 
C# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slidesC# Tutorial MSM_Murach chapter-21-slides
C# Tutorial MSM_Murach chapter-21-slides
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
 
C# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slidesC# Tutorial MSM_Murach chapter-17-slides
C# Tutorial MSM_Murach chapter-17-slides
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Intake 38 8
Intake 38 8Intake 38 8
Intake 38 8
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
 
Content
Content Content
Content
 
Oops Quiz
Oops QuizOops Quiz
Oops Quiz
 

Similar to C# Tutorial MSM_Murach chapter-11-slides

C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
Sami Mut
 
User exit training
User exit trainingUser exit training
User exit training
Jen Ringel
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
confidencial
 
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
Marcio Miranda
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
Marcio Miranda
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
confidencial
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
Marcio Miranda
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami Olusegun
Engr. Adefami Segun, MNSE
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming
Dr. Pankaj Zope
 
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
CSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docxCSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docx
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
faithxdunce63732
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
PCC
 
enhancements.ppt
enhancements.pptenhancements.ppt
enhancements.ppt
veerendra kumar
 
Csc153 chapter 04
Csc153 chapter 04Csc153 chapter 04
Csc153 chapter 04
PCC
 
Oracle forms 6_i__1_
Oracle forms 6_i__1_Oracle forms 6_i__1_
Oracle forms 6_i__1_
shashi.vaichal
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
muthusvm
 
Vb net xp_11
Vb net xp_11Vb net xp_11
Vb net xp_11
Niit Care
 
How to Implement Modbus TCP Protocol using VBA with Excel
How to Implement Modbus TCP Protocol using VBA with ExcelHow to Implement Modbus TCP Protocol using VBA with Excel
How to Implement Modbus TCP Protocol using VBA with Excel
ACC Automation
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
llflowe
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
bellflower42
 
AJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdfAJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdf
YaarJani
 

Similar to C# Tutorial MSM_Murach chapter-11-slides (20)

C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
 
User exit training
User exit trainingUser exit training
User exit training
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
 
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
04 conex%c3%a3o%20 logo!%200ba7%20com%20ihm
 
04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm04 conexão logo! 0 ba7 com ihm
04 conexão logo! 0 ba7 com ihm
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)05 conexão logo! 0 ba7 com ihm (wincc flexible)
05 conexão logo! 0 ba7 com ihm (wincc flexible)
 
Refinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami OlusegunRefinery Blending Problems by Engr. Adefami Olusegun
Refinery Blending Problems by Engr. Adefami Olusegun
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming
 
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
CSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docxCSCI1250    Project 3  Fall 2015  CSCI1250 INTRODUCTIO.docx
CSCI1250 Project 3 Fall 2015 CSCI1250 INTRODUCTIO.docx
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
 
enhancements.ppt
enhancements.pptenhancements.ppt
enhancements.ppt
 
Csc153 chapter 04
Csc153 chapter 04Csc153 chapter 04
Csc153 chapter 04
 
Oracle forms 6_i__1_
Oracle forms 6_i__1_Oracle forms 6_i__1_
Oracle forms 6_i__1_
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
 
Vb net xp_11
Vb net xp_11Vb net xp_11
Vb net xp_11
 
How to Implement Modbus TCP Protocol using VBA with Excel
How to Implement Modbus TCP Protocol using VBA with ExcelHow to Implement Modbus TCP Protocol using VBA with Excel
How to Implement Modbus TCP Protocol using VBA with Excel
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
 
AJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdfAJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdf
 

More from Sami Mut

MSM_Time
MSM_TimeMSM_Time
MSM_Time
Sami Mut
 
chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodiachapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodia
Sami Mut
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
Sami Mut
 
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodiachapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodia
Sami Mut
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
Sami Mut
 
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodiachapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodia
Sami Mut
 

More from Sami Mut (6)

MSM_Time
MSM_TimeMSM_Time
MSM_Time
 
chapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodiachapter 5 Java at rupp cambodia
chapter 5 Java at rupp cambodia
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
 
chapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodiachapter 3 Java at rupp cambodia
chapter 3 Java at rupp cambodia
 
chapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodiachapter 2 Java at rupp cambodia
chapter 2 Java at rupp cambodia
 
chapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodiachapter 1 Java at rupp cambodia
chapter 1 Java at rupp cambodia
 

Recently uploaded

“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

C# Tutorial MSM_Murach chapter-11-slides

  • 1. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 1 Chapter 11 How to debug an application
  • 2. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 2 Objectives Applied 1. Use the debugging techniques presented in this chapter to debug any unhandled exceptions or logical errors in the applications that you develop. Knowledge 1. Describe the differences between the three Step commands that you can use to control the execution of an application. 2. Describe the primary differences between the Autos window, the Locals window, and the Watch window. 3. Describe the use of the Immediate window. 4. Describe the call stack that’s displayed in the Call Stack window. 5. Explain how you can use the Console class to display information in the Output window.
  • 3. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 3 The Options dialog box
  • 4. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 4 The Exceptions dialog box
  • 5. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 5 The Future Value application in break mode
  • 6. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 6 Four ways to enter break mode • Force an unhandled exception to be thrown. • Set a breakpoint and run the application. • Choose the DebugStep Into command or press F11 to begin debugging at the first line of the application. • Choose the DebugBreak All command or press Ctrl+Alt+Break while the application is executing.
  • 7. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 7 The Future Value application with a data tip displayed
  • 8. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 8 The Future Value application with a breakpoint
  • 9. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 9 How to set and clear breakpoints • To set a breakpoint, click in the margin indicator bar to the left of a statement. Or, press the F9 key to set a breakpoint at the insertion point. • You can set a breakpoint before you run an application or while the application is in break mode. • To remove a breakpoint, use either technique for setting a breakpoint. To remove all breakpoints at once, use the DebugDelete All Breakpoints command. • To disable or enable all breakpoints at once, use the DebugDisable All Breakpoints or DebugEnable All Breakpoints command. Express Edition difference • The Breakpoints window is not available from Visual C# 2010 Express Edition.
  • 10. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 10 Commands in the Debug menu and toolbar Command Toolbar Keyboard Start/Continue F5 Break All Ctrl+Alt+Break Stop Debugging Shift+F5 Restart Ctrl+Shift+F5 Show Next Statement Step Into F11 Step Over F10 Step Out Shift+F11
  • 11. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 11 Commands in the Code Editor’s shortcut menu Command Description Run to Cursor Execute the application until it reaches the statement that contains the insertion point. Set Next Statement Set the statement that contains the insertion point as the next statement to be executed.
  • 12. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 12 The Locals window
  • 13. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 13 How to use the Locals window • The Locals window displays information about the variables within the current scope. • To display the Locals window, use the DebugWindowsLocals command. • If you are debugging a form and you click on the plus sign to the left of the this keyword, the properties and variables of the form are displayed. • To change the value of a property or variable, double-click on the value in the Value column, then type a new value and press the Enter key.
  • 14. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 14 How to use the Autos window • The Autos window works like the Locals window, but it only displays information about variables used by the current statement and the previous statement. • To display the Autos window, you can use the DebugWindowsAutos command. Express Edition difference • The Autos window isn’t available from the Visual C# 2010 Express Edition.
  • 15. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 15 A Watch window* *The Express Edition offers just one Watch window named Watch.
  • 16. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 16 The Immediate window
  • 17. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 17 The Call Stack window
  • 18. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 18 The Call Hierarchy window with two methods displayed
  • 19. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 19 An Output window that shows debug information
  • 20. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 20 An Output window that shows build information
  • 21. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 21 An Output window with debugging information
  • 22. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 22 Methods of the Console class that write data to the Output window Method Description Write(string) Displays the value of the specified string. WriteLine(string) Displays the value of the specified string, followed by a line break. 3 statements that write data to the Output window Console.WriteLine("Entering CalculateFutureValue method..."); Console.WriteLine("month: " + (i+1)); Console.WriteLine("futureValue: " + futureValue); Code that uses an if statement to control when data is written if ((i+1)%12 == 0) // every 12 months Console.WriteLine("futureValue: " + futureValue);
  • 23. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 23 The Visualizer drop-down menu in the Locals window
  • 24. Murach’s C# 2010, C11 © 2010, Mike Murach & Associates, Inc. Slide 24 The Text Visualizer dialog box