I am working with a C# program which utilises Microsoft Office Interop allowing you to essentially programatically use Microsoft Word, Excel and PowerPoint.
One unfortunate aspect I've encountered is that on occasion, the program will raise a dialogue box which pauses the code. This can happen for example if suddenly the code is not able to save in a location you expected to be able to, meaning your whole program is paused likely even if that issue is fixed later.
There are lots of other circumstances where an additional dialogue box might be raised.
So my intention is to implement some kind of timeout mechanism for this, whereby I can kill the Interop instance rather than have my whole program tied up. Can anyone suggest a way to do this? At the moment it wraps the Interop calls in a System.Action
and aborts that thread after a given time, but I wonder if there's a better way.