Comprehensive VB .NET Debugging

Mark Pearce

Apress ¢

Copyright 2003 Mark Pearce

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.




Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name , we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

Technical Reviewer: Pamela Fanstill
Editorial Directors: Dan Appleman, Gary Cornell, Simon Hayes, Martin Streicher, Karen Watterson, John Zukowski
Assistant Publisher: Grace Wong
Project Managers: Sofia Marchant, Nicole LeClerc
Copy Editor: Nicole LeClerc
Compositor and Proofreader: Impressions Book and Journal Services, Inc.
Indexer: Ann Rogers
Artist and Cover Designer: Kurt Krames
Production Manager: Kari Brooks
Manufacturing Manager: Tom Debolski

Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17, 69112 Heidelberg, Germany.

In the United States: phone 1-800-SPRINGER, email, or visit

Outside the United States: fax +49 6221 345229, email, or visit

For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info, or visit

The information in this book is distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.

The source code for this book is available to readers at in the Downloads section.

To Tamara: You make me whole, and in the process carve images on my soul. Thanks for civilizing me, loving me, and not killing me when I spent so much time working on this book.

To Clara Alexia: As I finished this book, you added your tiny sparkle to the 6 billion other sparkles that make up this river of humanity. Our hopes and our dreams fly with you into the future, where you'll see things that we never dreamt of.

To Martin: Your reference count finally reached zero and you sailed away into the darkness . Have some beers on me up there in the pub where the ale is real and flows forever. I'll be along soon.

Footfalls echo in the memory
Down the passage which we did not take
Towards the door we never opened
”T. S. Eliot

About the Author

Mark Pearce is a freelance consultant and developer specializing in the design and construction of investment banking systems. He specializes in software quality processes and has consulted for many blue-chip clients including Citigroup, Nomura, Barclays Capital, Lehmans, and British Petroleum. His other technical areas of interest include database design, middleware messaging, and distributed applications. In a previous life, Mark was a professional chess player who paid for his chess-playing bugs with near- starvation . His current hobbies of snowmobiling and mountain running are less energetic and more fun.

About the Technical Reviewer

Pamela Fanstill has over 20 years' experience working with information systems and holds a bachelor's degree in information systems management from the University of San Francisco. She has been focusing on Microsoft development tools since VB 3.0 and earned her first MCSD certification in 1996. For the last few years she has been teaching Visual Basic and related development technologies as a Microsoft Certified Trainer. Pam has been enthusiastic about .NET since beta 1 and is one of the charter MCADs for .NET. This is the third Apress .NET book for which Pam has served as technical reviewer. She has also been a technical contributor to the Microsoft and CompTIA certification programs. Pam lives in Northern California.


The first group of people I want to thank is the crew at Apress. Peter Wright was adamant that I could write this book, in spite of my reservations . Gary Cornell had the guts to take a big chance on a new author, based on nothing more than a rather grandiose book synopsis. Dan Appleman didn't veto Gary's decision, for which I'm very grateful!

As the project manager, Sofia Marchant led the project to bring this book to fruition, and refused to get testy or annoyed with me, no matter how many deadlines I missed. As the copy editor, Nicole LeClerc taught me that I didn't know as much about writing as I thought, and has forever changed the style in which I write. I promise never to use the passive form again, even if I still insist that the full stop should be outside the quotes. Next, Pamela Fanstill did a very thorough job of spotting my technical mistakes, testing and fixing my occasionally dubious code, and showing me where I wasn't being clear about the points I was trying to make. Perhaps even more important than all of the technical issues and handholding, Sofia, Nicole, and Pam all encouraged me with my writing and gave me real moral support during the more difficult times. I would also like to thank Production Manager Kari Brooks for actually getting this book out the door and shipping it.

There's a group of people I want to thank for encouraging and helping me during the writing of this book. Rob Macdonald and Peter Blackburn had many suggestions and helped me to organize my thoughts better. John Robbins, author of the outstanding Debugging Applications book, gave me probably the best advice on locking myself away to do the writing ”it's a shame that I didn't always follow his advice! Lawson Davies and my brother Jerome Pearce did technical reviews of some of the earlier chapters in this book. Habib Heydarian from the Microsoft .NET debugger team did full technical editing on the first few chapters before he had to step away. Finally, Gary Cornell resisted the temptation to make me rewrite my code without using Hungarian notation ”sorry, Gary!

Thanks to the amazing Chris Sells for allowing me to pinch and adapt his excellent demonstration of safe multithreading in a Windows Forms application ”you can see the result at the end of Chapter 14. Thanks also to Roedy Green for letting me reprint part of his very funny article on writing unclear code, which you can find in the "Interlude" section in Chapter 12. Finally, Scott Rosenberg, managing editor of online magazine, was kind enough to let me use the results of his magazine's haiku competition, which can be found in the "Interlude" section in Chapter 13.

Einstein is reported to have said something like, "If I've seen further, it's because I've been able to stand on the shoulders of giants." If he didn't say this, he should have. In my case, if I've seen anything at all, it's because I've been able to stand on the toes of great developers. I want to thank all those great developers who've helped me develop my technical skills over the years. Bob Frankel and Brian Skinner taught me about computers and how to write code. Donald Knuth, Joe Celko, Bruce McKinney, Jeffrey Richter, Ted Pattison, Steve McConnell, Steve Maguire, and Jim McCarthy have all written truly excellent books that have improved my software development skills to the point where I'm able to claim some proficiency. Peter Morris, Mark Hurst, Lawson Davies, and Mark Sewell of The Mandelbrot Set taught me more than I care to admit about Visual Basic. The books that I've read by Dan Appleman are a model of clarity and explained many concepts that I'd previously found confusing. In fact, I came to Apress primarily because of Dan's writing and my wish to produce similar.

My Mum and Dad brought me up with certain ethical and pragmatic values. This book, and my career, simply wouldn't have been done properly without having these values to guide me. The two of you must have been worried at times, but everything seems to have turned out okay in the end. My stepfather, Donald Swift-Hook, taught me the difference between facts and opinions , and the importance of applying an objective process to my work and my life.

My wife, Tamara, supported me throughout the writing of this book, sacrificing our social life and many evenings that should have been spent together. I'm sorry for the time this project took, and I hope that you're proud of the result. I love you very much.

As for my newborn daughter , Clara Alexia, I hope the royalties from this book will be enough to pay for your diaper bill!

Comprehensive VB .NET Debugging
Comprehensive VB .NET Debugging
ISBN: 1590590503
EAN: 2147483647
Year: 2003
Pages: 160
Authors: Mark Pearce © 2008-2017.
If you may any questions please contact us: