Exforsys

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor

Ads


Home arrow Technical Training arrow VB.NET 2005

Debugging Windows Applications In Visual Studio.NET 2005 Page - 2

Page 2 of 3
Author : Exforsys Inc.     Published on: 3rd Aug 2005    |   Last Updated on: 2nd May 2006

Debugging Windows Applications In Visual Studio.NET 2005

.

.

.

Ads

Analyzing Program State to Resolve Errors

The Visual Studio debugger is a powerful tool that allows users observe the state of the program and locate logic errors. The debugger works with all Visual Studio programming languages and their associated libraries. With the debugger, execution of the program can be suspended to examine the code, evaluate and edit variables in the program, view registers, see the instructions created from the source code, and view the memory space used by the application. With Edit and Continue, changes can be made to the code while debugging and continue execution.

The Visual Studio debugger provides a Debug menu for access to debugger tools. Debugger windows and dialog boxes display information about the program and allows the user enter additional information. Help can be obtained on any window or dialog box by pressing F1.

Debugging on Exceptions

An exception is an abnormal situation that happens while a program is running. Exceptions are often indications of problems that have to be debugged. When an exception occurs, the debugger writes an exception message to the Output window (unless disabled in the Options dialog box).

The debugger may or may not break execution when exception occurs.

  • If an exception occurs and is not handled, the debugger always breaks execution.
  • The debugger can be told to break execution immediately when an exception is thrown (before any handler is invoked).
  • If the user is debugging with Just Mode Code, a third option is also available. The debugger can be told to break on any exception that is not handled by a handler in user code ("My Code").

Remember, if an exception occurs and is not handled at all, the debugger always break. The user-unhandled setting does not change that.

The Visual Studio debugger recognizes the following categories of exceptions:

  • C++ Exceptions
  • Common Language Runtime Exceptions
  • Managed Debugging Assistants
  • Native Run-time Checks
  • Win32 Exceptions

Most exceptions have handlers, which are designed to respond to an exception when it occurs, giving the program a chance to recover from the abnormal situation. Native Run-time Checks do not have handlers.

In a Visual Basic application, the debugger represents all errors as exceptions, even if you use On Error–style error handlers.

For Visual Basic, C#, and J#, the debugger now features a new Exception Assistant that provides more information when an exception occurs.

Please note (Visual Basic and Visual C# only) If an uncaught exception occurs with the Exception Assistant turned off, a pseudovariable $exception is added to the Locals window. This pseudovariable can be expanded to see information on the exception.

Exception Assistant

The Exception Assistant is a new feature for debugging Visual Basic, C#, and J# applications. The Exception Assistant takes the place of the Exceptions dialog box that appears when an exception occurs in other languages, such as C/C++. The Exception Assistant provides more information on an exception than the Exceptions dialog box, making it easier for you to locate the cause of the exception and fix the problem.

The Exception Assistant, which appears whenever a run-time exception occurs in the debugger, shows the type of exception, troubleshooting tips, and corrective actions that may be applied through the Exception Assistant.

An exception is an object that inherits from the System.Exception class. An exception is thrown by code whenever a problem occurs; it is passed up the stack until the application handles it or the program fails.

Please note:-- The options available in dialog boxes, and the names and locations of menu commands, might differ from what is described in Help depending on the active settings or edition. This Help page was written with General Development Settings in mind. To change the settings, choose Import and Export Settings on the Tools menu.

The following table lists the actions that may appear in the Exception Assistant Actions pane:





Action

Description

Find out more about the exception

Displays the exception object's properties.

Add permission.

Adds necessary security permissions.To apply an action from the Exception Assistant Actions pane

  • Click the action you wish to perform.

Debugging a Running Process

The Processes window shows all processes that have been attached to or launched from Visual Studio.

In the Processes window, the user can choose any attached process and make it the current process for debugging. The user can also:

  • Terminate a process
  • Detach a process
  • Break a process
  • Continue a process

The Processes window is found in Visual C++ Express Edition and Visual Studio Professional, Enterprise, and Enterprise Architect Editions only. The default integrated development environment (IDE) settings chosen when Visual Studio is set up, may hide the menu command that displays this window. In that case, the user must add the command back to the Debug menu before this feature can be used.

Ads

The Visual Studio debugger has the ability to attach to a process that is running outside of Visual Studio. The attach capability can do the following:

  • Debug an application that was not created in Visual Studio.
  • Debug multiple processes simultaneously. (You can also debug multiple processes by starting multiple projects within a single solution.)
  • Debug a process running on a remote machine.
  • Debug a DLL that runs in a separate process that cannot easily be started from Visual Studio (for example, a service or an ISAPI DLL running with Internet Information Services).
  • Start the debugger automatically when a process crashes while running outside of Visual Studio (Just-In-Time debugging).

Once a program has been attached, the user can use debugger execution commands, inspect the program state, and so on. The ability to inspect the program may be limited, of course, depending on whether the program was built with debug information and whether the user has access to the program's source code, and whether the common language runtime JIT compiler is tracking debug information.

The Visual Studio debugger can be attached to any running process.



 
This tutorial is part of a VB.NET 2005 tutorial series. Read it from the beginning and learn yourself.

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor
 

Comments