There is a rarely occurring race condition - if an event is being dispatched in the main thread, providers and dependency registration is delayed, and upon completion of change, all delayed registration actions are executed. Because of lack of synchronization, it may happen that order of registration actions inside one thread of execution is broken and the dependency gets registered at a moment when one of the participating providers (normally a document) has not been registered yet.
See e.g. http://www.intellij.net/tracker/resharper/viewSCR?publicId=25251
How to fix: even if there no change currently being dispatched, always execute all pending actions before registering provider / dependency.