Null reference in async loop, but object has no nulls
问题 First, this is not answered by this SO post, as that describes simple/basic object reference problems. What I'm experiencing is related to multithreaded async processing, which the other post doesn't solve. I have a multithreaded .NET winforms app and I'm doing this: if ( paramList != null ) { lock ( paramList ) { foreach ( DictionaryEntry param in paramList ) { command.Parameters.AddWithValue(param.Key.ToString(), param.Value); } } } paramList is an OrderedDictionary . I sporadically get