Just spent a fair amount smacking myself in the head for the following bug:
Pretty basic stuff. A lookup into a cache (for perf reasons) and a lazy creation of an item if it wasn’t found. But wait! Go me! I redclared the spSynthesizedMember variable in a nested block and so my assignment wasn’t visible and it was only the addition of the below code that triggered this when it tried to derference null. This is one of those cases where I like the C# rules even if they can be pretty restrictive if you’ve come from a language that allows this.
Of course, I’d just be happy if the C++ compiler could warn on this sort of code so I could catch these bugs a lot faster.