This usually happens if you have something blocking the user interface thread and using COM components.
The best approach here is to transfer your lengthy operation to a background thread. This leaves your user interface responsive, which also means that COM messages may work correctly. BackgroundWorker is a good tool for this.
source share