| | Copyright |
| | Dedication |
| | Preface |
| | | 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 |
| | | Acknowledgments |
| | Chapter 1. CLR/Framework Gotchas |
| | | GOTCHA #1 Type alias size doesn't match what you're familiar with |
| | | GOTCHA #2 struct and class differ in behavior |
| | | GOTCHA #3 Returning value types from a method/property is risky |
| | | GOTCHA #4 You can't force calls to your value-type constructors |
| | | GOTCHA #5 String concatenation is expensive |
| | | GOTCHA #6 Exceptions may go unhandled |
| | | GOTCHA #7 Uninitialized event handlers aren't treated gracefully |
| | | GOTCHA #8 Division operation isn't consistent between types |
| | | GOTCHA #9 Typeless ArrayList isn't type-safe |
| | | GOTCHA #10 Type.GetType() may not locate all types |
| | | GOTCHA #11 Public key reported by sn.exe is inconsistent |
| | Chapter 2. Visual Studio and Compiler Gotchas |
| | | GOTCHA #12 Compiler warnings may not be benign |
| | | GOTCHA #13 Ordering of catch processing isn't consist across languages |
| | | GOTCHA #14 Type.GetType() might fail at run-time |
| | | GOTCHA #15 rethrow isn't consistent |
| | | GOTCHA #16 Default of Option Strict (off) isn't good |
| | | GOTCHA #17 Versioning may lead to Serialization headaches |
| | | GOTCHA #18 Creating Web apps can be painful |
| | | GOTCHA #19 Naming XML documentation for IntelliSense support isn't intuitive |
| | Chapter 3. Language and API Gotchas |
| | | GOTCHA #20 Singleton isn't guaranteed process-wide |
| | | GOTCHA #21 Default performance of Data.ReadXMLData.ReadXML |
| | | GOTCHA #22 enum lacks type-safety |
| | | GOTCHA #23 Copy Constructor hampers exensibility |
| | | GOTCHA #24 Clone() has limitations |
| | | GOTCHA #25 Access to static/Shared members isn't enforced consistently |
| | | GOTCHA #26 Details of exception may be hidden |
| | | GOTCHA #27 Object initialization sequence isn't consistent |
| | | GOTCHA #28 Polymorphism kicks in prematurely |
| | | GOTCHA #29 Unit testing private methodstesting private methods |
| | Chapter 4. Language Interoperability Gotchas |
| | | GOTCHA #30 Common Language Specification Compliance isn't the default |
| | | GOTCHA #31 Optional parameters break interoperability |
| | | GOTCHA #32 Mixing case between class members breaks interoperability |
| | | GOTCHA #33 Name collision with keywords breaks interoperability |
| | | GOTCHA #34 Defining an array isn't consistent |
| | Chapter 5. Garbage Collection Gotchas |
| | | GOTCHA #35 Writing Finalize() is rarely a good idea |
| | | GOTCHA #36 Releasing managed resources in Finalize( ) can wreak havoc |
| | | GOTCHA #37 Rules to invoke base.Finalize() aren't consistent |
| | | GOTCHA #38 Depending on Finalize() can tie up critical resources |
| | | GOTCHA #39 Using Finalize() on disposed objects is costly |
| | | GOTCHA #40 Implementing IDisposable isn't enough |
| | | GOTCHA #41 Using the Dispose Design Pattern doesn't guarantee cleanup |
| | Chapter 6. Inheritance and Polymorphism Gotchas |
| | | GOTCHA #42 Runtime Type Identification can hurt extensibility |
| | | GOTCHA #43 Using new/shadows causes "hideous hiding" |
| | | GOTCHA #44 Compilers are lenient toward forgotten override/overrides |
| | | GOTCHA #45 Compilers lean toward hiding virtual methods |
| | | GOTCHA #46 Exception handling can break polymorphism |
| | | GOTCHA #47 Signature mismatches can lead to method hiding |
| | Chapter 7. Multithreading Gotchas |
| | | GOTCHA #48 The Thread classThread class |
| | | GOTCHA #49 Foreground threads may prevent a program from terminating |
| | | GOTCHA #50 Background threads don't terminate gracefully |
| | | GOTCHA #51 Interrupt () kicks in only when a thread is blocked |
| | | GOTCHA #52 ThreadAbortExceptiona hot potato |
| | | GOTCHA #53 Environment.Exit() brings down the CLR |
| | | GOTCHA #54 ResetAbort() may lead to surprises |
| | | GOTCHA #55 Abort() takes time to clean up |
| | | GOTCHA #56 Calling Type.GetType() may not return what you expect |
| | | GOTCHA #57 Locking on globally visible objects is too sweeping |
| | | GOTCHA #58 Threads from the thread pool are scarce |
| | | GOTCHA #59 Threads invoked using delegates behave like background threads |
| | | GOTCHA #60 Passing parameters to threads is tricky |
| | | GOTCHA #61 Exceptions thrown from threads in the pool are lost |
| | | GOTCHA #62 Accessing WinForm controls from arbitrary threads is dangerous |
| | | GOTCHA #63 Web-service proxy may fail when used for multiple asynchronous calls |
| | | GOTCHA #64 Raising events lacks thread-safety |
| | Chapter 8. COM-Interop and Enterprise Services Gotchas |
| | | GOTCHA #65 Release of COM object is confusing |
| | | GOTCHA #66 Using interface pointers after calling ReleaseComObject() will fail |
| | | GOTCHA #67 Cross-apartment calls are expensive |
| | | GOTCHA #68 Default apartment of main thread is inconsistent across languages |
| | | GOTCHA #69 STAThread attribute may have no effect on your methods |
| | | GOTCHA #70 Spattering access to COM components makes code hard to maintain |
| | | GOTCHA #71 Auto-generating GUID for your classes leads to versioning woes |
| | | GOTCHA #72 All but one of the ClassInterface options are ineffective |
| | | GOTCHA #73 Simply tur ning the switch for COM interop is dangerous |
| | | GOTCHA #74 ServicedComponents implemented inconsistently on XP and 2003 |
| | | GOTCHA #75 AutoComplete comes with undesirable side effects |
| | Appendix: Resources |
| | | Bibliography |
| | | On the Web |
| | Colophon |
| | | About the Author |
| | | Colophon |
| | Index |