Crikey, never mind blogging about a beer each day, I should start a daily blog about the .NET 2.0 bugs that are driving me scranny. I'm pretty much working full time with VS2005 at the moment, and while in general I really love the new productivity and language enhancements, I seem to waste an inordinate amount of time trying to solve problems in my code that turn out to be bugs in the FCL.
Today's example: I'm currently much enamoured with Generics, and my favourite class of the moment is Systems.Collections.ObjectModel.KeyedCollection - if I can possibly use it I have been doing so (yeah, I know the old proverb about a man with a hammer).
Anyway, I couldn't sleep last night, so I got up at 5am and started hacking away at a web service that returned a domain object containing, amongst other types, a KeyedCollection. Or two. What could possibly go wrong?
Well, by 8am I was practically tearing my hair out, frustrated at repeatedly seeing "The given key was not present in the dictionary" every time I tried to invoke my service.
A little Googling later (wish I'd tried that sooner), and I found this post from Craig Andera publicizing a bug in XmlSerializer which prevents the serialization of a KeyedCollection. Sure enough, there's a bug logged on the MSDN Product Feedback centre about this issue. *sigh*
Back to the drawing board. Maybe this experience will cause me to snub generics in disgust and revert to using arrays... or comma-separated strings... ;-)