When a MS Office app is launched and closed from a VS Windows app with no internet connection, the MS Office app stays in Task Manager for a long time

  • Thread starter Thread starter Khanh Tu
  • Start date Start date
K

Khanh Tu

Guest
Hi, this is my first ever "Ask a question" post here, so if I've made any noob mistakes, I apologise now and please be kind :)

So, I've discovered a weird behaviour whilst developing a VS Windows app. If I:

1 - Run my app, which fires off a Process.Start("WINWORD.EXE") on a button click and launches MS Word (I have Office 365).
2 - After Word has launched, I close Word via the top right [ X ] button.

The expected behaviour in Task Manager would be that once I've closed Word via it's [ X ] button, the Word process would be killed off Task Manager too.

This expected behaviour does happen when my PC is connected to the internet. However, if I were to disconnect the internet connection, then try doing the same thing, after Word is closed, the Word process stays in Task Manager for a long time - 30 seconds or so before it's removed from Task Manager:

Task Manager after Word has been launched from my app:

1490667.png


Task Manager after Word is closed from UI, but stays in Task Manager for a long time:

1490668.png

Whilst the Word process does get killed eventually which means for most use cases, this isn't a problem. However, in my case, for my app, I want to warn the user that Word is still running, the 30 seconds of hanging around in Task Manager is enough to make my app think Word is still running, hence show a misleading warning on screen.

Does anyone here know why Word would hang around in Task Manager for such a long period when there is no internet connection? My best guess at the moment is that Word is trying to connect to MS Telemetry servers and can't, so it retries and retries, etc for 30 seconds before giving up.

Has anyone encountered this problem before? And if so, did you find fix or workaround for the problem?

I have made a test app to better illustrate the problem if anyone is interested to see it (the above screenshots are taken from this test app):

Dropbox - ClosingWordOffline.zip - Simplify your life

My setup is:
- Windows 10
- MS Office 365
- VS Pro 2017

Any response would be highly appreciated.

Thank you.

Khanh

Continue reading...
 
Back
Top