Slow Outlook startup with Add-in Express

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

Slow Outlook startup with Add-in Express
Long startup time for Outlook with Add-in express add-in enabled. 
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
Hi,
I would like to continue the following thread which is started by Shilpa is my colleague.
http://www.add-in-express.com/forum/read.php?FID=5&TID=5764

the description of the thread is as follows:
-------------------------------------------------------------------------------------------------------------------------------------------------
We have an Add-in Express add-in for Outlook in our product . This add-in causes the Outlook to take a long time for loading . We have got unsigned version of Add-in Express dlls , which the customer is using . Still , they are seeing a long startup time for Outlook ranging between 20-80 seconds on different machines. We analyzed the ADX logs from the customer's environment and saw the logs displaying delays similar to :

07:42:09 6576 Creating a new application domain.
07:42:10 6576 Success.
07:42:33 6576 Unwrapping the managed class.
07:42:34 6576 Success.

Apart from the above delay , in our add-in logs , we have seen a time gap between the various Add-in Express events (such as between add-in constructor and AddinCore.AddinCore_AddinInitialize and between AddinCore.AddinCore_AddinInitialize and AddinCore.AddinCore_AddinStartupComplete).

-------------------------------------------------------------------------------------------------------------------------------------------------

To confirm this i debugged my code and found that, following code is getting executed between add-in constructor and AddinCore.AddinCore_AddinInitialize and between AddinCore.AddinCore_AddinInitialize and AddinCore.AddinCore_AddinStartupComplete

// Required by Add-in Express - do not modify
// the methods within this region

/// <summary>
/// Required by Add-in Express - do not modify
/// </summary>
/// <returns>IContainer</returns>
public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}
This code is always getting executed, if i keep break point at this method, its keep looping for ever and control is not coming out of from this method.

which is causing start-up delay. Please suggest suitable resolution for the issue.

Regards,
Sridhar K
Posted 04 Dec, 2009 01:39:19 Top
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
Here is the log file information. we can observe 40 seconds delay in the log file.

12.04.2009 10:13:19.2831800: AddinCore.AddinCore_AddinInitialize Method begin
12.04.2009 10:13:19.2831800: AddinCore.AddinCore_AddinInitialize Method end
//********20 Seconds Delay Here....System.ComponentModel.IContainer GetContainer() method being invoked here**********

12.04.2009 10:13:39.3017513: AddinCore.AddinCore_AddinStartupComplete Method begin
//Variable intialization part goes here
12.04.2009 10:13:39.8643341: AddinCore.AddinCore_AddinStartupComplete Method end

12.04.2009 10:13:39.9112160: AddinCore.adxOutlookEvents_NewExplorer Toolbar.Visible = True
//********20 Seconds Delay Here....CommandBarsUpdate() event implemented here**********

12.04.2009 10:15:59.0662283: AddinCore.AddinCore_AddinBeginShutdown Method Begin
12.04.2009 10:15:59.0974779: AddinCore.AddinCore_AddinBeginShutdown Method end


12.04.2009 10:16:05.1443523: AddinCore.AddinCore_AddinFinalize Method begin
12.04.2009 10:16:05.0665739: AddinCore.AddinCore_AddinFinalize Method end

We implemented adxOutlookEvents_CommandBarsUpdate() event whcih is causing 20 seconds delay. Here is the code we implemented in CommanBars Update event

private void adxOutlookEvents_CommandBarsUpdate(object sender, EventArgs e)
{
_toolbarVisible = this.adxOlExplorerCommandBar.Visible;
if (_lastVisible != _toolbarVisible)
{
adxOutlookEvents_NewExplorer(sender, e);
}
this.adxOlExplorerCommandBarCore.Enabled = true;
//Verify whether toolbar is loosing the textbox, if Yes place the toolbar to previous location. Toolbar Width is fixed.
if (this.adxOlExplorerCommandBarCore.Width < 420)
{
adxOlExplorerCommandBarCore.Left = _cmdBarLeft;
adxOlExplorerCommandBarCore.RowIndex = _cmdBarRowIndex;
//Verify the condition Again, if toolbar is loosing the text box still, allign it to default positon.
if (this.adxOlExplorerCommandBarCore.Width < 420)
{
adxOlExplorerCommandBarCore.Left = 0;
adxOlExplorerCommandBarCore.RowIndex = -1;
}
}
//Save the toolbar postion
else
{
_cmdBarLeft = this.adxOlExplorerCommandBarCore.Left;
_cmdBarRowIndex = this.adxOlExplorerCommandBarCore.RowIndex;
}
}
private void adxOutlookEvents_NewExplorer(object sender, object explorer)
{
_lastVisible = _toolbarVisible;
}

Are we doing any thing wrong in the code. The above code we implemented to place our toolbar in particular location. In debug mode, if i keep break point at this method, its keep looping for ever and control is not coming out of from this method. While this event is executing, defult add-in express method(System.ComponentModel.IContainer GetContainer()) which i specified in my previous thread also being invoked.

Due to which, the 40 seconds delay in opening outlook.

This is can be easily reproducable in any environment.

Thank you.

Regards
Sridhar
Posted 04 Dec, 2009 06:55:46 Top
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
We are using
1. adxloader version 5.1.2022.
2. We are using WINDOWS XP and is up to date.
3. Outlook 2007 and Up to date

Log file which i mentioned is created in our application.

adxloader.log file is:

Add-in Express Loader Log File: 12/04/2009 10:13:17

Startup directory: C:\Programme\Hewlett-Packard\HP EAsE Outlook Plug-In\
Loader version: 5.1.2022
------------------
10:13:17 5436 3404 Start.
10:13:17 5436 3404 Reading the registry key 'HKEY_CLASSES_ROOT\CLSID\{47870958-3078-4E5D-8F66-9B85B63368E6}'
10:13:17 5436 3404 Success. The registry key 'HKEY_CLASSES_ROOT\CLSID\{47870958-3078-4E5D-8F66-9B85B63368E6}' is closed.
10:13:17 5436 3404 Converting the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID from string.
10:13:17 5436 3404 Success.
10:13:17 5436 3404 Attempting to get the class object by the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID.
10:13:17 5436 3404 Success.
10:13:17 5436 3404 Creating a new instance of the add-in loader.
10:13:17 5436 3404 Success.
10:13:17 5436 3404 Loading the configuration from the system registry.
10:13:17 5436 3404 Getting the latest CLR version.
10:13:17 5436 3404 The latest CLR version is 'v2.0.50727'.
10:13:17 5436 3404 The configuration has been loaded successfully.
10:13:17 5436 3404 Runtime version: v2.0.50727.
10:13:17 5436 3404 Assembly name: HPOutlookSearch, PublicKeyToken=602EEA34ADA86E66.
10:13:17 5436 3404 Class name: HP.EAsE.ArchiveSearch.AddinCore.
10:13:17 5436 3404 Attempting to create a new instance of the managed add-in class: CLR - v2.0.50727
10:13:17 5436 3404 Loading CLR: v2.0.50727.
10:13:17 5436 3404 The CLR v2.0.50727 has been initialized successfully.
10:13:17 5436 3404 Creating a new domain setup.
10:13:17 5436 3404 Success.
10:13:17 5436 3404 Getting the add-in directory.
10:13:17 5436 3404 Success. The directory is 'C:\Programme\Hewlett-Packard\HP EAsE Outlook Plug-In\'
10:13:17 5436 3404 The configuration file is '(null)'
10:13:17 5436 3404 The 'shadow copy' is enabled.
10:13:17 5436 3404 Creating a new application domain.
10:13:17 5436 3404 Success.
10:13:17 5436 3404 Unwrapping the managed class.
10:13:18 5436 3404 Success.
10:13:18 5436 3404 Querying the add-in extensibility.
10:13:18 5436 3404 Querying the custom task panes.
10:13:18 5436 3404 Querying the ribbon extensibility.
10:13:18 5436 3404 Success.
10:13:18 5436 3404 Querying the form regions.
10:13:18 5436 3404 Success.
10:13:18 5436 3404 The managed add-in class has been created successfully.

Please give us some hints how to solve this.

Regards
Sridhar
Posted 04 Dec, 2009 07:55:35 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello Sridhar,

I don't see any delay in the log file you listed above.

Please install the latest build of Add-in Express. You can download it here.

BTW Don't forget to replace the adxloader.dll in the Loader folder of your project with a new one.
.NET, Extended MAPI, Windows Phone & RT
Posted 04 Dec, 2009 09:40:59 Top
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
Thanks for your response,

I have some specific questions here;

1)
public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

Why this method is required for Add-In express?
What this method does?
Why this method running forever in the background? we observed some delay(20 seconds) due to this method.

2)
Is CommandBarsUpd ate() not preferable to use in code? this event is also running forever. due to which we observed delay.
Is there any other alternative availble for this event?

I can say these two are running forever, because "if i keep break points in code, control is not coming out of these".

3)
Did any performance/slow startup related issues fixed in the latest add-in express version? if not, no use of upgraded to latest version.

4)
See the adxloader.log file below which shows the delay:

Add-in Express Loader Log File: 12/07/2009 14:53:01

Startup directory: D:\Sources\OutlookPlugin\OutlookSearch\bin\
Loader version: 5.1.2022
------------------
14:53:01 4296 2480 Start.
14:53:01 4296 2480 Reading the registry key 'HKEY_CLASSES_ROOT\CLSID\{47870958-3078-4E5D-8F66-9B85B63368E6}'
14:53:01 4296 2480 Success. The registry key 'HKEY_CLASSES_ROOT\CLSID\{47870958-3078-4E5D-8F66-9B85B63368E6}' is closed.
14:53:01 4296 2480 Converting the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID from string.
14:53:01 4296 2480 Success.
14:53:01 4296 2480 Attempting to get the class object by the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID.
14:53:01 4296 2480 Success.
14:53:01 4296 2480 Creating a new instance of the add-in loader.
14:53:01 4296 2480 Success.
14:53:01 4296 2480 Loading the configuration from the system registry.
14:53:01 4296 2480 Getting the latest CLR version.
14:53:01 4296 2480 The latest CLR version is 'v2.0.50727'.
14:53:01 4296 2480 The configuration has been loaded successfully.
14:53:01 4296 2480 Runtime version: v2.0.50727.
14:53:01 4296 2480 Assembly name: OutlookSearch, PublicKeyToken=602EEA34ADA86E66.
14:53:01 4296 2480 Class name: ArchiveSearch.AddinCore.
14:53:01 4296 2480 Attempting to create a new instance of the managed add-in class: CLR - v2.0.50727
14:53:01 4296 2480 Loading CLR: v2.0.50727.
14:53:01 4296 2480 The CLR v2.0.50727 has been initialized successfully.
14:53:01 4296 2480 Creating a new domain se tup.
14:53:01 4296 2480 Success.
14:53:01 4296 2480 Getting the add-in directory.
14:53:01 4296 2480 Success. The directory is 'D:\Sources\OutlookPlugin\OutlookSearch\bin\'
14:53:02 4296 2480 The configuration file is '(null)'
14:53:02 4296 2480 The 'shadow copy' is enabled.
14:53:02 4296 2480 Creating a new application domain.
14:53:02 4296 2480 Success.
14:53:07 4296 2480 Unwrapping the managed class.
14:53:07 4296 2480 Success.
14:53:07 4296 2480 Querying the add-in extensibility.
14:53:07 4296 2480 Querying the custom task panes.
14:53:07 4296 2480 Querying the ribbon extensibility.
14:53:07 4296 2480 Success.
14:53:07 4296 2480 Querying the form regions.
14:53:07 4296 2480 Success.
14:53:07 4296 2480 The managed add-in class has been created successfully.

You can observe 5 seconds delay at "Unwrapping the managed class." in the above log file.

Regards
Sridhar
Posted 07 Dec, 2009 03:44:16 Top
Andrei Smolin


Add-in Express team


Posts: 9472
Joined: 2006-05-11
Sridhar,

GetContainer. Try to check the call stack when you set a breakpoint in that method; it is needed to get all the components that you added onto the add-in module. Say, Add-in Express loops through the components when the add-in is being connected or sidconnected, when generating the Ribbon UI markup, when a command bar is added onto the add-in module, etc.

we observed some delay(20 seconds) due to this method.


Please send your data to the support e-mail address (see readme.txt) for us to understand what is happening.

CommandBarsUpdate. Microsoft describes the OnUpdate event of the CommandBars class as follows:
The event is triggered by any change to a command bar or command bar control or any change to the state of a command bar or command bar control. These changes can occur due to a text or cell selection, for example. Since a large number of OnUpdate events can occur during normal usage, developers should exercise caution when using this event. It is strongly recommended that this event be used primarily for checking that a custom command bar has been added or removed by a COM AddIn.


On delays. A short version of what we know about how to fight against delays is published at Delays at add-in start-up. I strongly recommend that have a look at Performance problems for network profiles to get understanding of what we know about delays and their reasons. Note that in your case the delay occurs exactly at the same stage. Because such delays also occur for shared add-ins and VSTO add-ins, we think this is a universal problem, not just Add-in Express related. Probably it is caused by configuration settings but this is just a guess; I have no confirmation or disproof of it.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 07 Dec, 2009 06:03:51 Top
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
Hi Andrei,

Thanks for your reply. As you suggested/links provided in this topic, we performed those actions with no luck.

1. We disabled the Certificate Revocation.
2. We disabled Antivirus temporarly.
But still we observed slow startup of outlook.

My Suspicion is in the GetContainer() method. Only this method is executed before and after AddinCore_AddinInitialize() event and we observed 20 seconds delay before and after this event.
Can you please tell me what is implemented in this method?

Any suggestions please?

Regards
Sridhar.
Posted 09 Dec, 2009 03:39:41 Top
Andrei Smolin


Add-in Express team


Posts: 9472
Joined: 2006-05-11
Sridhar,

public virtual System.ComponentModel.IContainer GetContainer()
{
if (defaultContainer == null)
defaultContainer = new System.ComponentModel.Container();
return defaultContainer;
}


I'd suggest comparing some settings of a PC on which thre's no delay with the affected one(s) but I truly don't know waht to look at.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Dec, 2009 03:55:05 Top
Sridhar Kapavarapu




Posts: 59
Joined: 2009-07-29
Hi Andrei,

Is it useful to compacting the mailbox?

Performing Comapcting mailbox is like:
Right Click on Mailbox from Outlook-->Properties-->Advanced
Select Advanced Tab-->Offline Folder Settings-->Compact Now

Which compacts the outlook.ost file.

Regards
Srdhar K
Posted 17 Dec, 2009 06:53:13 Top
Andrei Smolin


Add-in Express team


Posts: 9472
Joined: 2006-05-11
Hi Srdhar,

Sorry, I don't understand your question. Does it relate to the topic?

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 17 Dec, 2009 07:13:13 Top