.Net Gotchas

( 3 )


Like most complex tasks, .NET programming is fraught with potential costly, and time-consuming hazards. The millions of Microsoft developers worldwide who create applications for the .NET platform can attest to that. Thankfully there's now a book that shows you how to avoid such costly and time-consuming mistakes. It's called .NET Gotchas.The ultimate guide for efficient, pain-free coding, .NET Gotchas from O'Reilly contains 75 common .NET programming pitfalls—and advice on how to work around them. It will help ...

See more details below
Paperback (1st Edition)
BN.com price
(Save 23%)$39.95 List Price
Other sellers (Paperback)
  • All (22) from $1.99   
  • New (8) from $19.08   
  • Used (14) from $1.99   
.NET Gotchas: 75 Ways to Improve Your C# and VB.NET Programs

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 43%)$31.99 List Price


Like most complex tasks, .NET programming is fraught with potential costly, and time-consuming hazards. The millions of Microsoft developers worldwide who create applications for the .NET platform can attest to that. Thankfully there's now a book that shows you how to avoid such costly and time-consuming mistakes. It's called .NET Gotchas.The ultimate guide for efficient, pain-free coding, .NET Gotchas from O'Reilly contains 75 common .NET programming pitfalls—and advice on how to work around them. It will help you steer away from those mistakes that cause application performance problems, or so taint code that it just doesn't work right.The book is organized into nine chapters, each focusing on those features and constructs of the .NET platform that consistently baffle developers. Within each chapter are several "gotchas," with detailed examples, discussions, and guidelines for avoiding them. No doubt about it, when applied, these concise presentations of best practices will help you lead a more productive, stress-free existence.What's more, because code examples are written in both VB.NET and C#, .NET Gotchas is of interest to more than 75 percent of the growing numbers of .NET programmers. So if you're a .NET developer who's mired in the trenches and yearning for a better way, this book is most definitely for you.

Read More Show Less

Product Details

  • ISBN-13: 9780596009090
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 5/31/2005
  • Edition description: 1st Edition
  • Edition number: 1
  • Pages: 396
  • Product dimensions: 7.06 (w) x 9.18 (h) x 0.95 (d)

Meet the Author

Dr. Venkat Subramaniam (venkats@agiledeveloper.com) is the founder of Agile Developer, Inc. (a software training, mentoring and development firm), and a co-founder of DuraSoft. Working with .NET since its Beta 2 pre-release, he's used the platform extensively on commercial projects for his clients. Venkat offers several courses on developing applications using .NET, and has trained and mentored more than 3,000 software developers in the US and Europe. A frequent speaker at software development conferences, he is also an adjunct professor for the practice of computer science at University of Houston, and teaches at Rice University's School for Continuing Studies. Venkat holds a BS in Computer Engineering, an MS in Electrical Engineering, and PhD in Computer Science. He is recipient of the 2004 UH Computer Science Department Teaching Excellence award.

Read More Show Less

Table of Contents

Who This Book Is For;
What You Need to Use This Book;
Measure of Performance;
Conventions Used in This Book;
Using Code Examples;
Comments and Questions;
Safari® Enabled;
Chapter 1: CLR/Framework Gotchas;
1.1 GOTCHA #1 Type alias size doesn’t match what you’re familiar with;
1.2 GOTCHA #2 struct and class differ in behavior;
1.3 GOTCHA #3 Returning value types from a method/property is risky;
1.4 GOTCHA #4 You can’t force calls to your value-type constructors;
1.5 GOTCHA #5 String concatenation is expensive;
1.6 GOTCHA #6 Exceptions may go unhandled;
1.7 GOTCHA #7 Uninitialized event handlers aren’t treated gracefully;
1.8 GOTCHA #8 Division operation isn’t consistent between types;
1.9 GOTCHA #9 Typeless ArrayList isn’t type-safe;
1.10 GOTCHA #10 Type.GetType() may not locate all types;
1.11 GOTCHA #11 Public key reported by sn.exe is inconsistent;
Chapter 2: Visual Studio and Compiler Gotchas;
2.1 GOTCHA #12 Compiler warnings may not be benign;
2.2 GOTCHA #13 Ordering of catch processing isn’t consist across languages;
2.3 GOTCHA #14 Type.GetType() might fail at run-time;
2.4 GOTCHA #15 rethrow isn’t consistent;
2.5 GOTCHA #16 Default of Option Strict (off) isn’t good;
2.6 GOTCHA #17 Versioning may lead to Serialization headaches;
2.7 GOTCHA #18 Creating Web apps can be painful;
2.8 GOTCHA #19 Naming XML documentation for IntelliSense support isn’t intuitive;
Chapter 3: Language and API Gotchas;
3.1 GOTCHA #20 Singleton isn’t guaranteed process-wide;
3.2 GOTCHA #21 Default performance of Data.ReadXMLData.ReadXMLData.ReadXML;
3.3 GOTCHA #22 enum lacks type-safety;
3.4 GOTCHA #23 Copy Constructor hampers exensibility;
3.5 GOTCHA #24 Clone() has limitations;
3.6 GOTCHA #25 Access to static/SharedC#code examplesShared members isn’t enforced consistently;
3.7 GOTCHA #26 Details of exception may be hidden;
3.8 GOTCHA #27 Object initialization sequence isn’t consistent;
3.9 GOTCHA #28 Polymorphism kicks in prematurely;
3.10 GOTCHA #29 Unit testing private methodstesting private methodstesting private methods;
Chapter 4: Language Interoperability Gotchas;
4.1 GOTCHA #30 Common Language Specification Compliance isn’t the default;
4.2 GOTCHA #31 Optional parameters break interoperability;
4.3 GOTCHA #32 Mixing case between class members breaks interoperability;
4.4 GOTCHA #33 Name collision with keywords breaks interoperability;
4.5 GOTCHA #34 Defining an array isn’t consistent;
Chapter 5: Garbage Collection Gotchas;
5.1 GOTCHA #35 Writing Finalize() is rarely a good idea;
5.2 GOTCHA #36 Releasing managed resources in Finalize() can wreak havoc;
5.3 GOTCHA #37 Rules to invoke base.Finalize() aren’t consistent;
5.4 GOTCHA #38 Depending on Finalize() can tie up critical resources;
5.5 GOTCHA #39 Using Finalize() on disposed objects is costly;
5.6 GOTCHA #40 Implementing IDisposable isn’t enough;
5.7 GOTCHA #41 Using the Dispose Design Pattern doesn’t guarantee cleanup;
Chapter 6: Inheritance and Polymorphism Gotchas;
6.1 GOTCHA #42 Runtime Type Identification can hurt extensibility;
6.2 GOTCHA #43 Using new/shadows causes “hideous hiding”;
6.3 GOTCHA #44 Compilers are lenient toward forgotten override/overrides;
6.4 GOTCHA #45 Compilers lean toward hiding virtual methods;
6.5 GOTCHA #46 Exception handling can break polymorphism;
6.6 GOTCHA #47 Signature mismatches can lead to method hiding;
Chapter 7: Multithreading Gotchas;
7.1 GOTCHA #48 The Thread classThread classThread class;
7.2 GOTCHA #49 Foreground threads may prevent a program from terminating;
7.3 GOTCHA #50 Background threads don’t terminate gracefully;
7.4 GOTCHA #51 Interrupt () kicks in only when a thread is blocked;
7.5 GOTCHA #52 ThreadAbortException—a hot potato;
7.6 GOTCHA #53 Environment.Exit() brings down the CLR;
7.7 GOTCHA #54 ResetAbort() may lead to surprises;
7.8 GOTCHA #55 Abort() takes time to clean up;
7.9 GOTCHA #56 Calling Type.GetType() may not return what you expect;
7.10 GOTCHA #57 Locking on globally visible objects is too sweeping;
7.11 GOTCHA #58 Threads from the thread pool are scarce;
7.12 GOTCHA #59 Threads invoked using delegates behave like background threads;
7.13 GOTCHA #60 Passing parametersthreadsparameters to threads is tricky;
7.14 GOTCHA #61 Exceptions thrown from threads in the pool are lostexceptionslost;
7.15 GOTCHA #62 Accessing WinForm controls from arbitrary threads is dangerous;
7.16 GOTCHA #63 Web-service proxy may fail when used for multiple asynchronous calls;
7.17 GOTCHA #64 Raising events lacks thread-safety;
Chapter 8: COM-Interop and Enterprise Services Gotchas;
8.1 GOTCHA #65 Release of COM object is confusing;
8.2 GOTCHA #66 Using interface pointers after calling ReleaseComObject() will fail;
8.3 GOTCHA #67 Cross-apartment calls are expensive;
8.4 GOTCHA #68 Default apartment of main thread is inconsistent across languages;
8.5 GOTCHA #69 STAThread attribute may have no effect on your methods;
8.6 GOTCHA #70 Spattering access to COM components makes code hard to maintain;
8.7 GOTCHA #71 Auto-generatingGUIDgenerating GUID for your classes leads to versioning woes;
8.8 GOTCHA #72 All but one of the ClassInterface options are ineffective;
8.9 GOTCHA #73 Simply tur ning the switch for COM interop is dangerous;
8.10 GOTCHA #74 ServicedComponents implemented inconsistently on XP and 2003;
8.11 GOTCHA #75 AutoComplete comes with undesirable side effects;
On the Web;

Read More Show Less

Customer Reviews

Average Rating 4.5
( 3 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted November 14, 2005


    Are you among the many programmers who have come to appreciate how powerful Microsoft's .NET Framework can be as a platform for development? If you do, this book is for you! Author Venkat Subramaniam, has done an outstanding job of writing a great book that shares his .NET experiences with developers, to help them avoid the gotchas! Subramaniam begins by discussing the features in the CLR and the Framework that can impact the behavior and performance of your application. Next, the author focuses on Visual Studio- and compiler-related gotchas. Then, he delves into gotchas at the language and API level of the .NET platform. The author continues by discussing the issues of language operability gotchas. In addition, the author next focuses on concerns related to garbage collection, and how to write code that handles it effectively. He also discusses, the things you need to be aware of in the areas of inheritance and polymorphism so you can make the best use of these important concepts. Next, the author addresses the general problems with threading, the thread pool, asynchronous calls using delegates, and threading problems related to Windows Forms and Web Services. Finally, he focuses on details you should be aware of to make interoperability work for you. With the preceding in mind, the author has also done an excellent job of writing a book that focuses on the .NET Framework and language features that have consistently exhibited behavior that is not obvious to the programmer. So, why should you be interested in learning about these unexpected features? Because, knowning these little gotchas will help you avoid mistakes!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 14, 2005

    Want to really understand .NET?

    At my work, we have a pretty rigorous application process. Once of the most difficult aspects of our application process is the series of very difficult .NET questions, which determine the applicant¿s understanding of C# and the .NET CLR. If you read this book before taking our .NET test, not only will you pass, but you¿ll probably be able to put some of the testers to shame. This is one of the best books I¿ve read on the ¿under the hood¿ aspects of the CLR. This book is filled with tips (e.g. gotcha #12 ¿ compiler warnings may not be benign), which are then followed by an explanation of what the problem is, and how it can be resolved. In the example above, the author describes how .NET will allow you to do things that you probably shouldn¿t be allowed to do. In this particular example, the programmer used ¿=¿ instead of ¿==¿, and failed to mark a method in a derived class with the ¿override¿ keyword. This book also does an excellent job describing some of the differences between C# and VB.NET. For example, the author illustrates that the sequence of initialization is not the same between the two languages. In terms of organization, when the author identifies a ¿gotcha¿, there is a clear code example provided that exploits the problem. The author even displays a large ¿X¿ next to the code, so you know not to use it. After discussing how to resolve the problem, the author usually provides code that is safe to use (which is identified with a large check mark next to it). Without a doubt, this is the best book I have read on the subject of things to look out for in the .NET framework. The issues discussed in this book should be known by every .NET developer. At least read the book before your next job interview.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted June 6, 2005

    mixing languages?

    A nice, random access book on C# and VB.NET programming. You are expected to know the rudiments of at least one of these languages. It might be worthwhile to have this book around, as a possible quick time saver, if you're debugging. Looking over the gotchas, one sees how the ambitious scope of .NET has sometimes caused problems. In any given language, you know that certain names cannot be used for variables or classes, because they are reserved keywords. But .NET lets you mix source code from different languages. If you do this, the reserved keywords in C#, say, effectively expand to include keywords in those other languages. Something you never had to worry about before. Another gotch arises due to arrays. In C#, the array size is one more than the maximum allowed index. In VB, the array is made with that maximum value. Inconsistent. The book has other items that are more intricate. Some of these might be new to you.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)