I've encountered a situation where due to some other area of code I called failing to copy a Dictionary<TKey, TValue>
that it returns, a concurrency problem ensues: the Dictionary
appears to contain illegal null keys.
I've fixed the underlying bug, but to help identify this issue should it crop up again in the future I'm adding a bit of code that explicitly checks for the null key in the loop that processes the returned dictionary and throws before things go any further. I'm not sure which exception class to throw, or which one to subclass if I'm defining a new one.