List of Listings


Chapter 2: Language Surprises in VB .NET

Listing 2-1. What Is True Really?
Listing 2-2. Ambiguous Overloading
Listing 2-3. Member Overloading in VB .NET vs. C#
Listing 2-4. C# Translation of Listing 2-3
Listing 2-5. More Member Overloading in VB .NET vs. C#
Listing 2-6. C# Translation of Listing 2-5
Listing 2-7. Don't Forget to Override
Listing 2-8. Normal Inheritance Hierarchy
Listing 2-9. Lame Cat Equal to Any Other Cat?
Listing 2-10. Corrected LameCat.Equals Member
Listing 2-11. Using Protection with Inheritance
Listing 2-12. Where Am I?
Listing 2-13. What the Developer Writes
Listing 2-14. What the Compiler Sees
Listing 2-15. What the Developer Sees
Listing 2-16. Is This Better?
Listing 2-17. This Is Best
Listing 2-18. What the Developer Writes
Listing 2-19. What the Developer Sees
Listing 2-20. What the VB .NET Compiler Sees
Listing 2-21. The C# Translation of Listing 2-18
Listing 2-22. What the C# Developer (and Compiler) Sees
Listing 2-23. Boxing Can Be Dangerous
Listing 2-24. Division by Zero
Listing 2-25. Seeing Double
Listing 2-26. Trouble When You Don't Cater Properly to NaN
Listing 2-27. Seeing Double
Listing 2-28. Double Trouble

Chapter 5: Other Debugging Tools

Listing 5-1. Error Handling Comparison
Listing 5-2. CIL Produced by On Error Resume Next
Listing 5-3. CIL Produced by Try Catch Finally
Listing 5-4. Modifying a String Manually
Listing 5-5. Modifying a String Using StringBuilder
Example 1. Assembly Must Execute with Full Trust
Example 2. Assembly Must Execute with Internet Trust
Example 3. Assembly Must Have Full Rights to a Specific File and Folder
Example 4. Assembly Must Be Allowed to Read Anything in a Specific Folder
Example 5. Assembly Must Be Able to Read Part of the Registry
Example 6. Assembly Must Be Able to Use the Clipboard
Example 7. Assembly Must Have Access to System Dialog Boxes
Example 8. Assembly Must Be Able to Use Assertions

Chapter 6: Tracing and Instrumentation

Listing 6-1. Using Trace.WriteLine
Listing 6-2. Using Trace.WriteLineIf
Listing 6-3. Trace.WriteLineIf Performance Constraint
Listing 6-4. Using Trace.Assert
Listing 6-5. Using Trace.Fail
Listing 6-6. Example of an Assertion Message
Listing 6-7. Determining If Tracing Is Active
Listing 6-8. Removing the Default Trace Listener
Listing 6-9. Sending Trace Information to the System Console
Listing 6-10. Sending Trace Information to a Text File
Listing 6-11. Sending Trace Information to the Application Event Log
Listing 6-12. Custom Trace Listener for Recording Performance Data
Listing 6-13. Using the Custom Trace Listener
Listing 6-14. The XML Produced by the Custom Trace Listener
Listing 6-15. Using the BooleanSwitch Class
Listing 6-16. Creating and Using the TraceSwitch Class
Listing 6-17. Using the Custom Trace Switch
Listing 6-18. Creating the Custom Trace Switch
Listing 6-19. XML to Add a Trace Listener at Runtime
Listing 6-20. XML for Changing the Sensitivity of Two Trace Switches
Listing 6-21. XML to Deactivate a Boolean Switch at Runtime
Listing 6-22. XML to Redirect Assertion Failure Messages at Runtime
Listing 6-23. Determining If Debug Is Active
Listing 6-24. Creating the Performance Category and Counters
Listing 6-25. Initialization of Each Performance Counter Instance

Chapter 7: Windows Forms Debugging

Listing 7-1. Implementing the Numeric TextBox Control
Listing 7-2. Controlling and Viewing Control Debug Events

Chapter 8: Web Services Debugging

Listing 8-1. The Debug Setting in TimeServer's Web.config
Listing 8-2. The TimeService Class
Listing 8-3. Exception Produced by the ThrowExceptionRaw Web Method
Listing 8-4. The ThrowExceptionCustom Web Method Throws a Custom Exception
Listing 8-5. Creating a Custom SoapException with Required Information
Listing 8-6. Displaying the Custom Exception in the Client Application
Listing 8-7. Hiding Exception Details for Nonlocal Users
Listing 8-8. CustomErrors Setting in TimeServer's Web.config
Listing 8-9. The Bare-bones SoapMonitor Custom SOAP Extension
Listing 8-10. Setting Up Access to the SOAP Stream Memory Buffer
Listing 8-11. Complete SoapMonitor Custom SOAP Extension
Listing 8-12. The SoapMonitorAttribute Custom SOAP Attribute
Listing 8-13. Binding the SoapMonitor Extension to a Web Method
Listing 8-14. The ProcessMessage Method on a Client-Based SOAP Extension
Listing 8-15. Binding the SoapMonitor Extension to a Web Method

Chapter 9: ASP .NET Debugging

Listing 9-1. Triggering an Unhandled Exception
Listing 9-2. Triggering and Catching an Exception Within a Procedure
Listing 9-3. Triggering a Page-Level Exception
Listing 9-4. Dealing with a Page-Level Error Using the Page_Error Event
Listing 9-5. Using Web.config to Redirect an Exception to a Custom Page
Listing 9-6. Triggering an Application-Level Exception
Listing 9-7. Dealing with an Application-Level Error Using an Application_Error Event
Listing 9-8. Using Web.config to Redirect Various Exception Types
Listing 9-9. Enabling Page-Level Tracing at Design Time
Listing 9-10. Enabling Page-Level Tracing at Runtime
Listing 9-11. Enabling Application-Level Tracing
Listing 9-12. Loading the Trace Viewer Page

Chapter 10: Windows Services Debugging

Listing 10-1. Running a Windows Service As a Standard.exe
Listing 10-2. Updating ServiceAdmin's Description During Installation

Chapter 11: VB .Classic Debugging

Listing 11-1. VB .NET Component Code for Use by a COM Client
Listing 11-2. Type Library Information with a ClassInterface Attribute of AutoDispatch
Listing 11-3. Type Library Information with a ClassInterface Attribute of AutoDual
Listing 11-4. VB .NET Can Combine COM Early Binding with Good COM Versioning
Listing 11-5. Type Library Information with a Separately-Implemented Interface

Chapter 12: SQL Server Debugging

Listing 12-1. Creating the Test Tables
Listing 12-2. Creating the Test Stored Procedure
Listing 12-3. The Corrected Stored Procedure

Chapter 13: Error Handling and Exception Management

Listing 13-1. Pseudo-Code for Try Catch Finally
Listing 13-2. Probing the System.IO.File.Move Method
Listing 13-3. Improving the System.IO.File.Move Method
Listing 13-4. A Bad Way to "Improve" the System.IO.File.Move Method
Listing 13-5. Hiding an Implementation Detail with a Framework Exception
Listing 13-6. Hiding an Implementation Detail with a Custom Exception
Listing 13-7. A Usable UserLoadException Custom Exception
Listing 13-8. UserLoadException Custom Exception with Serialization
Listing 13-9. UserLoadException Custom Exception with the UserId Property
Listing 13-10. UserLoadException Complete Custom Exception
Listing 13-11. An Unhandled Exception Filter That Reports Exception Information
Listing 13-12. Implementing a Realistic Unhandled Exception Filter
Listing 13-13. Overriding the Windows Form Built-in Unhandled Exception Dialog Window
Listing 13-14. Catering to Every Possible Type of Unhandled Exception Situation
Listing 13-15. Publishing an Exception Using the Exception Management Application Block

Chapter 14: Debugging Multithreaded Applications

Listing 14-1. The CountCoordinator Class
Listing 14-2. The CountWorker Class
Listing 14-3. Adding SyncLock to Synchronize Access to Shared Data
Listing 14-4. The Bank Class
Listing 14-5. The Cashier Class
Listing 14-6. The Account Class
Listing 14-7. A Hypothetical Transfer Method
Listing 14-8. A Thread-Safe Class for Reading and Writing Shared Data
Listing 14-9. Displaying All Win32 Threads Within a Specified Process
Listing 14-10. Displaying All User Threads Within a Specified Process
Listing 14-11. Code to Launch the Calculation Thread
Listing 14-12. Performing the Accumulation Calculation
Listing 14-13. Updating the User Interface with Intermediate Calculation Results
Listing 14-14. Canceling the Calculation
Listing 14-15. Completing the Calculation
Listing 14-16. Trapping Any Calculation Thread Exception



Comprehensive VB .NET Debugging
Comprehensive VB .NET Debugging
ISBN: 1590590503
EAN: 2147483647
Year: 2003
Pages: 160
Authors: Mark Pearce

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net