VSTO Add-In for MS Word getting disabled automatically all the time - vsto

I've developed a VSTO Add-In for MS Word. When I'm installing the Add-In into client's machines, every time I've to enable the Add-In Manually.
I've signed my add-in using a Certificate.
Can anybody help me why the add-in is getting disabled again and again.
Any help is highly appreciated.

Right after installing the add-in I'd suggest checking the LoadBehavior key value (before MS Word is started). By default, this entry is set to 3, which specifies that the VSTO Add-in is loaded at startup. Read more about such keys in the Registry entries for VSTO Add-ins article.
Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.
Hard disabling can occur when a VSTO 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 VSTO Add-in is executing.
Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article.

I figured out the issue.
MS Office disables the Add-ins automatically, if it crashes. In my case the exception was thrown from the starting point i.e.
ThisAddIn_Startup
Office was not able to instantiate the the add-in, because there was no document open and was causing this exception.
This was the exception: This command is not available because no document is open.
To fix this error, I wrote following lines which opens a blank MS Word Document, if any document is not open:
if (Application.Documents.Count == 0)
this.Application.Documents.Add();

Related

Legacy VSTO add in deactivated in Outlook 2016

I've inherited care for a legacy Outlook add in, triggered by an issue reported by an end-user, stating that the add-in isn't activated anymore.
What I know
We have an old custom add-in:
Written in .NET 4 Client Profile
As a VSTO project
Written in VB.NET
It worked fine on Outlook 2010, the user's recently been updated to 2016.
Symptoms
After installation, loading Outlook takes much longer
You have to manually activate the add-in
If you do, the menu/ribbon is loaded correctly
On shutdown / restart of Outlook, the add in is inactivated again
It's config'd to be x86. I've tried switching that to x64, because I'm on a 64 bit OS, but then the addin just didn't load.
What I've looked into
I've googled a bit and found this link: CRM for Outlook Add-In keeps disabling
I think this quote describes what's going on:
Microsoft has some security measures in place to prevent slow add-ins
from running inside Outlook. The issue is however that in many cases
add-ins without fault are mistakenly marked as slow and disabled by
Outlook, and if this is not immediately corrected when it first
happens, Outlook may permanently disable them with no easy way to
re-enable them.
I've researched with the help of an infrastructure/network engineer colleague to see if we can toggle the add-in to always enable, but no luck.
I've investigated eventviewer logs, I found this:
Outlook loaded the following add-in(s):
...
...
Name: AteamAddin
Description: AteamAddin
ProgID: AteamAddin
GUID: {00000000-0000-0000-0000-000000000000}
Load Behavior: 3
HKLM: 0
Location: file:///C:/Development/Deployment/AteamAddin.vsto
Boot Time (Milliseconds): 328
Followed by an entry with only my add-in on activating in Outlook, but with:
Boot Time (Milliseconds): 172
That's much slower than the second slowest, which loads in 47 milliseconds, but honestly, even 328 milliseconds isn't even that bad for a custom addin.
A weird thing is the empty GUID:
GUID: {00000000-0000-0000-0000-000000000000}
But I don't know if it's important. I've tried adding a Guid attribute to my ThisAddIn class, but no effect.
Question
What can I do to have Outlook 2016 accept the custom add-in?
The load time looks good, I don't see anything strange there. Instead, I'd suggest making sure no exceptions are fired at runtime. Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.
Hard disabling can occur when a VSTO 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 VSTO Add-in is executing.
Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article.
Also, I'd recommend making sure all the required prerequisites were included to the add-in package.
The application needs two folders to move mails to, so it checks / creates it on startup of the add-in. It looks like Outlook 2016 is more restrictive in what is allowed. Checking these folders likely takes longer than Outlook allows, so the add-in is deactivated.
I moved the checking and creation of these folders to whenever a user opens any of the forms. That way it's way later in the process and that works without issue.

Add-In not enabled after restart in Outlook 2010

I would appreciate any help as I have exhausted every solution I found at this point.
The Load Behavior of an Outlook Add-In is listed as "Unloaded" under File > Options > Add-Ins > COM Add-ins. It will load and work as expected if I manually check the add in. However it automatically disables when Outlook is restarted. I cannot find a way to make this stick. The following is what I have tried based on Google searches:
The registry shows that all available LoadBehavior options are set to 3, which indicates that it should load automatically. For good measure I searched for every occurrence of "LoadBehavior" to see if I was missing anything, but they are all set to 3.
The "Resiliency" options in the registry called "CrashingAddinList" and "DisabledItems" are empty, indicating that this add-in is not being forced to disable. Again I searched for every occurrence of this in the registry and they look good.
I added a "DoNotDisableAddinList" entry into the resiliency in the registry and gave it a value of 1. This is supposed to load the add-in no matter what.
I uninstalled the add-in, cleared out any reference to it in the registry, rebooted, and reinstalled. The same issue continues.
If I set the user as an administrator on their desktop, the add-in is loaded automatically in Outlook and works as expected. This is the only time it works, however nobody else has this issue and they are not set as administrators on the desktop.
Any ideas?
Thanks
Ian
Looks like your add-in fires an exception at startup...
Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.
Hard disabling can occur when a VSTO 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 VSTO Add-in is executing.
Hard disabled add-ins are listed under the DisabledItems windows registry key.
Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. See How to: Re-enable a VSTO Add-in that has been disabled for more information.

Add-in is not loading in office

I have a word com add-in that has been working fine previously but due to some reasons, I reinstalled my Windows-OS, MS-office and add-in software right after that It is showing in inactive add-in category. but the load behavior is "load at startup".
unable to find the exact reason. please help me and tell me how to debug this and know the root cause of this
There are multiple reasons why add-ins are disabled by host applications...
First of all, I'd recommend checking all the required prerequsites on the target machine. Make sure that al of them were installed correctly before running the host application with your add-in registered.
Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.
Hard disabling can occur when an VSTO 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 VSTO Add-in is executing.
Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. Read more about that in the How to: Re-enable a VSTO Add-in That Has Been Disabled article.
You may also find the following articles helpful:
Troubleshooting COM Add-In load failures
Troubleshooting Run Time Errors in Office Solutions

How to display Custom Taskpane in Office 2013?

I have developed an Excel Addin using VSTO 4.0.
There is a Custom taskpane that contains various controls to perform functions.
the Custom Taskpane works fine with office 2010 and is displayed on left.
but When i install the addin for office 2013 on Windows 8.1 it does not apear at all?
Below is the code snippet im using to display the taskpane;
var taskPaneProcessMapView = new TaskPanes.taskpaneProcessMap().GetInstance();
this.TaskPaneProcessMap = Globals.ThinkReliabilityAddIn.CustomTaskPanes.Add(taskPaneProcessMapView, "Process Map");
this.TaskPaneProcessMap.Visible = false;
this.TaskPaneProcessMap.Visible = false;
May be you need to set the Visible property to true?
Anyway, is your add-in enabled? Did you have a chance to check out the COM add-ins list in Excel? Is it listed in the Inactive add-ins list?
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. See How to: Re-enable an Add-in That Has Been Disabled for more information.

Outlook Add In crash report

If there is a crash of an Outlook Add In and the exception is unhandled, is there a way to obtain crash log data for that particular Add In?
Nope. I'd suggest handling exceptions in the code. Also I'd recommend creating a log file for each add-in run and write all operations there. It will help you to diagnose the issue.
You can check this source for more info on VSTO logging and alerts, but in essence you change two environment variable values depending on what you need to do:
Displaying VSTO Alert Prompts
To display each error in a message box, set the VSTO_SUPPRESSDISPLAYALERTS variable to 0 (zero). You can suppress the messages by setting the variable to 1 (one).
Logging VSTO Alerts to a Log file
To write the errors to a log file, set the VSTO_LOGALERTS variable to 1 (one).
Visual Studio Tools for Office creates the log file in the folder that contains the application manifest. The default name is .manifest.log. To stop logging errors, set the variable to 0 (zero).
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.