ADXOutlookItemEvents.ConnectTo can take up to few seconds

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

ADXOutlookItemEvents.ConnectTo can take up to few seconds
Performance issue when connecting to events in outlook 2007 
Gutek Jakub




Posts: 32
Joined: 2017-06-06
We are having small problem in one of our applications. After some time of using Outlook one user (currently one from around 100) is experiencing performance issue with outlook when he switch between applications.

By detailed trace we have found that line:


// _itemEvents => OutlookItemEventsClass : AddinExpress.MSO.ADXOutlookItemEvents
_itemEvents.ConnectTo(mail, true);


is taking longer and longer to execute. Its stars with few milliseconds and goes up to few seconds (max was 3). During execution of that ConnectTo outlook is unresponsive. Restarting outlook fix issue for some time.

ConnectTo is always executed after checking if IsConnected and RemoveConnection. I was even trying to optimize this with checking if currently connected item is the same that i want to connect, just to not to do too many ConnectTo, but it didn't help:

public bool Reconnect(object item, bool release)
{
    if (item == this.ItemObj)
    {
        return true;
    }

    if (IsConnected)
    {
        RemoveConnection();
    }

    // this line takes up to few seconds
    bool connected = ConnectTo(item, release);

    return connected;
}


This happens in Outlook 2007.

Any ideas what we can do/make to fix this problem?

Thanks!
Posted 07 Sep, 2017 08:40:35 Top
Andrei Smolin


Add-in Express team


Posts: 14705
Joined: 2006-05-11
Hello Gutek,

I don't think that the cause of the issue is located in the code of Add-in Express. Check if the issue is reproducible with other COM add-ins turned off; if you have Microsoft VBA for Outlook add-in, don't turn it off. Also, I'd check if turning the antivirus off solves the issue.

If the above doesn't help, check if using VBA to connect to events produces the same issue. Open the VBA IDE in Outlook (Alt+F11), and paste the code below to the ThisOutlookSession class:

[CODE]Dim WithEvents itm As Outlook.MailItem

Sub startWorking()
Debug.Print "startWorking 1: " + CStr(Now)
'Set itm = Application.ActiveInspector.CurrentItem
Set itm = Application.ActiveExplorer().Selection.Item(1)
Debug.Print "startWorking 2: " + CStr(Now)
End Sub

Sub stopWorking()
Set itm = Nothing
Debug.Print "stopWorking"
End Sub

Private Sub itm_Forward(ByVal Forward As Object, Cancel As Boolean)
Debug.Print "itm_Forward"
End Sub[QUOTE]

The code above connects to events of the selected item; it reports all actions to the Immediate window (menu View | Immediate Window). It handles the Forward event simply to illustrate that the events are connected.

Now, test your add-in and when the delay becomes too big, execute the startWorking method: put the text cursor on any line of the method and press {F5}. Does this work with the same delay?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 07 Sep, 2017 10:21:42 Top
Gutek Jakub




Posts: 32
Joined: 2017-06-06
Thanks, i have asked user to do test with other plugins. We know that disabling our plugin solves this issue.

Moreover (i'm waiting for confirmation) this only happens once when you switch from other application to outlook. So outlook is minimazed/in background, and user from i.e. Excel with ALT+TAB or click switch to Outlook.

I will come back with answers i've got from tests. Once again thanks for the idea to check with other add ins off.
Posted 07 Sep, 2017 10:50:55 Top
Andrei Smolin


Add-in Express team


Posts: 14705
Joined: 2006-05-11
Please keep me informed.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Sep, 2017 05:18:43 Top
Gutek Jakub




Posts: 32
Joined: 2017-06-06
Hi,

Finally user responded, hopefully i will have more details about this soon.

This is still an issue for less then 1% of testing users.

Will come back to it hopefully soon
Posted 13 Dec, 2017 07:41:29 Top
Andrei Smolin


Add-in Express team


Posts: 14705
Joined: 2006-05-11
Also, pay attention if the issue occurs on a special message store: Explorer, Explorer Online, HotMail, GMail, or PST.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Dec, 2017 08:11:28 Top
Gutek Jakub




Posts: 32
Joined: 2017-06-06
Hi Andrei,

Just had a call with end user. And it seams its only issue with plugin. VBA code was executed in less then a second. But plugin code was taking around 2-4s.

Moreover, user was on special version of plugin - skeleton. Witch only wires Outlook events and shows buttons. but does nothing. From today tests, plugin worked fine since 12pm until 3/4pm. Some users reports that this is something that is happening after some period of time (2 users) and one user just have this all the time.

I know this could be different issues, but from log perspective they are all related to: ConnectTo method in OutlookItemEvents.

if needed I can share code with you. Strange things is that that this only happens to really few users or maybe other are not contacting us.
Posted 13 Dec, 2017 11:04:11 Top
Andrei Smolin


Add-in Express team


Posts: 14705
Joined: 2006-05-11
Hello Jakub,

I suggest that you try to repair Outlook data files used by your users; see https://support.office.com/en-us/article/Repair-Outlook-Data-Files-pst-and-ost-25663bc3-11ec-4412-86c4-60458afc5253. Does this solves the issue?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 14 Dec, 2017 05:16:26 Top
Gutek Jakub




Posts: 32
Joined: 2017-06-06
I'm waiting for confirmation about this, will come back when I have something.
Posted 18 Dec, 2017 07:23:29 Top
Gutek Jakub




Posts: 32
Joined: 2017-06-06
Hi Andrei,

Two users come back, clearing OST files does not fix issue with ConnectTo.

Basically skeleton application that does nothing, just connects to events and shows buttons (no other interactions) are causing performance issue as showed above.

Hardware varies from top notch to old one, outlook 2007 and 2010, users with 2013 or 2016 did not reported any performance issue.

Any ideas what else can we check?
Posted 22 Dec, 2017 07:49:26 Top