none
Possible causes for VSTO add-in crash? RRS feed

  • Question

  • Hi all,

    I've been developing VSTO add-in for a few years already (since VSTO 2005 SE). Thousands (maybe) of user has used my VSTO solutions in their MS Office application (Word, Excel, Outlook, PowerPoint). But there is one thing that still remain all this year, sometime user(s) will complain that the VSTO add-in has gone missing. After doing troubleshoot, the result were most likely the VSTO add-in has been disabled or in-active. However, the frequency of VSTO add-in gone missing has been reduced by using newer version of Visual Studio (from 2005 to 2008 and now 2012).

    Feedback from user (during troubleshoot, that I can remember)

    1. Office application crashed while using the add-in (ex: crash after clicking a button in the add-in). Re-open Office application, add-in missing.
    2. Office application crashed due to other reasons (PC suddenly hang, black-out)
    3. Add-in missing after some Windows/Microsoft Update.
    4. Did not open Office application for a long time (more than 2 weeks).
    5. Some component (VSTO Runtime, .Net Framework, Office PIA) suddenly missing/corrupted.

    So I Purposely create a few Word add-in (empty add-in, which do nothing, another test add-in with a button that will displayed a message box when clicked). Run it in test machine along with the original add-in. Try to 'crash' all add-ins by doing above possible steps and other 'not so smart' move... The result I get: very hard to make Word disabled those add-ins, although there were a few times the add-in did get disabled. Even the empty add-in also can get disabled (WOW)...

    Note1: my add-in make use of external dll (mine also), which could be the 'real' reason why add-in get disabled. But the empty add-in is, well, empty.

    Note2: Many users also may have other 3rd party add-ins (conflict??)

    Note3: Environment could be anything, from Windows XP, Vista, 7, 8, Server and Office 2003 to 2013.

    Note4: I managed to borrow 1 PC from a client (who complain that Office application always crash..bla..bla) for a few months. Well, not even once Office application crashed during testing (seriously). Did my best to emulate what a normal user would do. Open a document, do some editing, click button in the add-ins, copy paste, save document, close. re-open and close. Repeated many times.

    Note5: User will/might have different behavior on how they use their Office application.

    I wonder whether other VSTO developer also faced this scenario, and is it frequent? Actually this post is more that just a question, I'm hoping everyone can share their experience. Maybe it can help me built a better solutions.

    Thank you.



    • Edited by azmas Tuesday, January 6, 2015 7:53 AM
    Tuesday, January 6, 2015 2:36 AM

All replies

  • Hello azmas,

    There can be various reasons why the add-in is disabled by Office applications, but the most widely spread case is exceptions in the code. That's why I'd suggest adding log statements to the code. So, you will always be aware what was happened under the hood.

    In general, Microsoft Office applications can disable add-ins that behave unexpectedly. If an application does not load your add-in , the application might have hard disabled or soft disabled your add-in.

    Hard disabling can occur when an add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your add-in is executing.

    Soft disabling can occur when an add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable an add-in if it throws an unhandled exception while the Startup event handler is executing.

    When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused the application to soft disable the add-in has not been fixed, the application will soft disable the add-in again.

    You can read more about that in the How to: Re-enable an Add-in That Has Been Disabled article in MSDN.

    Tuesday, January 6, 2015 10:04 AM
  • Eugene, thanks for the reply.

    I did include try..catch in the codes, but maybe it doesn't implemented properly. I will relook at my codes to see whether I can make enhancement to it or not.

    Wednesday, January 7, 2015 9:30 AM
  • Hi azmas,

    If possible, it would be better that you can share the project on the OneDrive, we will check it.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 8, 2015 1:33 AM
    Moderator