You may face “DisconnectedContext was detected” error if you work with Excel interop objects in C#. This error causes crashing your application. It is really annoying issue and there is no specific resolution for this. So, I’ll give the general idea in this post.
Context 0xdf76a0′ is disconnected. Releasing the interfaces from the current context (context 0xdf7450). This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the application is completely done with the RuntimeCallableWrappers that represent COM components that live inside them.
Try to run your application in “release mode” instead of “debug mode“. Sometime this error doesn’t show up in “release mode”. So, you may want not to do anything about it.
If the problem is still going on, publish your application (Project > Properties > Publish). Do you have the same problem? If you don’t, it doesn’t mean you have resolved it. You have just ignored it. If you want to resolve it forever, go back to step 1 and try hard.