This addin was disabled because it made outlook slow to startup

Add-in Express™ Support Service
That's what is more important than anything else

This addin was disabled because it made outlook slow to startup
How to force this message ? 
Tim Smet




Posts: 12
Joined: 2015-10-06
Hi,

Some of our users are getting the message "This addin was disabled because it made outlook slow to startup", the thing is nomatter what i try in my addin's code i can never get message. I have some code in the "adxCOMAddInModuleAddInInitialize" event but as far as i can see this does not have an impact on outlook addin startup time when i look in the windows event log for the startup time (event id 45). I even tried adding a sleep(5000) statement in the initialize event and not even this made the message appear in my outlook 2016 and the startup time does not seem to change when looking at the event id's. I did notice that whenever i build a new addin dll the first time i start outlook using this new dll that the startup time goes up a little.

I have read here that addinexpress uses a special loader to prevent the message from happening by loading at the last possible moment depending on the code one uses.

So i'd like to know if it's not my code or sleep statements in addininitialize event that make this message appear with some of our customers how can i for example for testing purposes let it appear on purpose on my dev machine using add in express and what else does have an impact on the startup time because as far as i tested it doesn't seem to be anything related to my code.

To be on the safe side would using the onstartupcomplete event be a better place to place the small code i have in addininitialize ? The code just loads a language, intializes a few log classes, extract and icon and checks for the existance of a few dll files that we use (and load dynamically when needed, so not at startup).

I know the threshold is 1000ms for startup the startup with one of our users was just above it 1069ms and it displayed the message.

The thing i'm going to try is add this registry key (see here https://www.slipstick.com/outlook/always-load-an-outlook-addin/) using one of our main programs for our addin, which should prevent this from happening but not sure if it would help much.

so basically:
- why does sleep statement in addinintialize does not have an effect (i'm guessing it's the way addin express loads the addins at the last possible moment)
- how to forcefully create an addin that will display the message (so increase startup time, addin sleep to addinintialize event does not seem to have an effect)
- is onstartupcomplete the best place to some intialisation stuff compared to addinintialize ?
- will that registry setting really help ?

Thanks
Posted 18 Jan, 2017 06:13:58 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Tim,

Tim Smet writes:
- why does sleep statement in addinintialize does not have an effect (i'm guessing it's the way addin express loads the addins at the last possible moment)


This is a result of Add-in Express loading the add-in at a moment which isn't controlled by Outlook.

Tim Smet writes:
- how to forcefully create an addin that will display the message (so increase startup time, addin sleep to addinintialize event does not seem to have an effect)


There's no way to create such an add-in using Add-in Express. At least, our developers aren't aware of it.

Tim Smet writes:
- is onstartupcomplete the best place to some intialisation stuff compared to addinintialize ?


There's no difference; the events are raised by Add-in Express as part of processing the same Office event. Again, the time required to handle this event isn't controlled by Outlook.

Tim Smet writes:
- will that registry setting really help ?


It should.

Tim Smet writes:
I know the threshold is 1000ms for startup the startup with one of our users was just above it 1069ms and it displayed the message.


In our practice, this only occurs if there is another add-in(s) that loads slowly. That is, we have never saw a situation when an Add-in Express based add-in alone was punished.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 07:29:49 Top
Tim Smet




Posts: 12
Joined: 2015-10-06
Hi Andrei,

Thanks for the answers so if i understand correctly any code inside onstartupcomplete or addinintialize does not have an impact on addinstartup time ? That wasn't clear to me, but it does seem by testing that this is the case

I did manage to get the message in outlook 2016 by running outlook and the addin through the delphi debugger and setting a breakpoint at "TadxFactory.Create(ComServer, TCoDcsOutlookAddin, CLASS_CoDcsOutlookAddin, TAddInModule);" in the intialisation section and waiting for 5 seconds. I repeated this 2 - 3 times and the after a next restart i had gotten the message displayed. Placeing a sleep statement in the intialisation section gives the same result because code in the intialisation sections is executed right after the dll got loaded. This also means that perhaps any units that my addin directly or indrectly uses that has code in the initialisation sections has an impact on startup time. so i'll see if that's the case somewhere.

But at least now i can test the registry entry to be sure by forcing this message in outlook by placing a sleep(2000) statement in the intialisation section of the TAddInModule (or any other unit that has an intialisation section).

I do have not so many other addins installed but i don't know if that's the case with our clients i'll have to verify that with the clients having the problem
Posted 18 Jan, 2017 08:17:08 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Tim,

Please forgive me: I've responded to your first post assuming mistakenly that you talk about the .NET edition of Add-in Express. There is a great difference between the .NET and VCL editions: a .NET-based add-in can only work if the .NET Framework is loaded. The loader (it is written in unmanaged C++) exists in the .NET edition only because it loads the .NET Framework and does other .NET-related stuff. Doing this *may* take an unpredictable amount of time. This is why Microsoft suggests (see https://msdn.microsoft.com/en-us/library/office/jj228679.aspx, note that I refer to this page below):

Prefer native COM add-ins over managed add-ins since managed add-ins must incur the overhead of loading the .NET Framework during Outlook startup.

The above isn't the case with a Delphi based add-in. So please let me respond once again to your questions:

Tim Smet writes:
- why does sleep statement in addinintialize does not have an effect (i'm guessing it's the way addin express loads the addins at the last possible moment)


On the page mentionde above, they write:

Measures the time in milliseconds for the add-in to complete startup using the IDTExtensibility2_OnConnection event. By default, if the median time over 5 successive iterations exceeds the performance threshold, Outlook disables the add-in.

Tim Smet writes:
- how to forcefully create an addin that will display the message (so increase startup time, addin sleep to addinintialize event does not seem to have an effect)


Use the info above to create such an add-in.

Tim Smet writes:
- is onstartupcomplete the best place to some intialisation stuff compared to addinintialize ?


There's no difference; the events are raised by Add-in Express as part of processing the same Office event. Again, the time required to handle this event isn't controlled by Outlook.

Tim Smet writes:
- will that registry setting really help ?


It should.

Sorry for the confusion.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 08:45:51 Top
Tim Smet




Posts: 12
Joined: 2015-10-06
Hi Andrei,

Thanks again for the answer.

I understand outlook only displays the message after a 5 iterations but each time you start outlook with an addin being loaded it displays the addinstartup time foreach addin in the windows event log using an event with eventid 45 and i understand that the median of 5 such entries needs to be above 1000ms for the message to be displayed.

example of such entry:

Naam: CoDcsOutlookAddin
Beschrijving: 
ProgID: DcsOutlookAddin.CoDcsOutlookAddin
GUID: {780424FB-4D5E-4044-A0C7-2A2DFEE11662}
Laadgedrag: 3
HKLM: 0
Locatie: C:UsersDWAppDataRoamingDcSoftAddinsOutlookDcsOutlookAddIn.dll
Opstarttijd (milliseconden): 109


https://support.microsoft.com/en-us/kb/2617010

the thing is i don't really understand what you mean with "the events are raised by Add-in Express as part of processing the same Office event. Again, the time required to handle this event isn't controlled by Outlook. "

Basically what i wanted to know is my code inside those event handlers could have an effect on that startup time measured by outlook. so basically checking if placing code (sleep 5000) inside either of those event's increase the "Opstarttijd" entry in the event log as far as i can see it does not since placing a sleep(5000) does not make "Opstarttijd" increase by 5000 it stays the same around 109 so the only conclusion i can have is that code placed in those events has no impact on the time outlook measured it took for the addin to start so even starting outlook 5 times with a sleep 5000 inside either those event handlers will never produce the message in outlook as it seems to be fired after outlook was already started up / stopped measuring addin startup time. So even if my addin would have code that takes 1 hour to complete in one of those 2 events it will never display the message not even after running it 5 times so it has no effect and you can place any code for as long as it takes. You do however notice it in outlook but it has no effect on the value being written with event id 45 each time you start outlook and thus no effect on the message being displayed or not. Maybe we are saying the same thing in a diffrent way ? but looking at my tests it has no effect.

there might be other events that haven an impact but i do not use them in my addin code.

Things i did see that have an effect on that number:
- intialisation section code by any unit used from the addin
- time it takes to create TadxFactory (but that's because of the point above).
- using a fresly build addin dll for the 1st time

I did not try putting sleep statments in onstartup event handlers yet since i don't use those in my normal code so it is of no meaning for just wanted to know about those 2 events which i guess has no impact at least thats what my tests show and event id 45
Posted 18 Jan, 2017 09:28:20 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
According to that page, they calculate the time required to handle the IDTExtensibility2.OnConnection method. In that method, Add-in Express only creates the add-in module.

The AddinInitialize and AddinStartupComplete events of the module are invoked when they call IDTExtensibility2.OnStartupComplete. There's one exception to this rule: these events are invoked from the code of IDTExtensibility2.OnConnection if you enable the add-in using the COM Add-ins dialog.

See TadxAddin.OnConnection.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 10:53:52 Top