How to find and fix an Access Violation in an Outlook Plugin with ADX?

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

How to find and fix an Access Violation in an Outlook Plugin with ADX?
 
TJ Oosterkamp




Posts: 6
Joined: 2023-01-02
Hi,

I'm trying to figure out why my Outlook Plugin throws an Access Violation every once in a while.

The Windows Event Log says:
"Add-in execution error. Outlook crashed during the 'Activate' callback of the 'ExplorerEvents' interface while calling into the 'QnE' add-in."

It doesn't occur all the time. There doesn't seem to be any action on my part that triggers this, although I think it happens more often when using the built in Search function in Outlook.

I have read through all my code and don't see any obvious culprits.

Where do I start figuring out why this happens?

Thanks,
TJ
Posted 02 Jan, 2023 13:54:23 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello TJ,

Does this relate to using ESET? Have a look at https://www.add-in-express.com/forum/read.php?SHOWALL_1=1&FID=1&TID=16450#nav_start.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Jan, 2023 05:27:01 Top
TJ Oosterkamp




Posts: 6
Joined: 2023-01-02
Thanks, Andrei. But no, I don't use ESET.

I experienced this same issue with my previous 2012 version of Add-In Express. I'm not sure, but it may be starting to happen when upgrading beyond Outlook 2010 or so.

I had hoped to finally fix it by upgrading to the new Add-In Express, as this should be compatible again.

Any other suggestions or a step-by-step approach to find bugs when using Add-In Express?

Otherwise I may have to go back and build up my add-in step by step to see which part is causing the AV. That's doable, but doesn't sound like a lot of fun.

Thanks, TJ
Posted 03 Jan, 2023 12:46:39 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello TJ,

TJ Oosterkamp writes:
Otherwise I may have to go back and build up my add-in step by step to see which part is causing the AV. That's doable, but doesn't sound like a lot of fun.


You can also add debug messages to your code in order to locate the issue. On the other hand, sometimes, an issue can be a long-term effect of some other action that the add-in performs.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Jan, 2023 09:48:20 Top
TJ Oosterkamp




Posts: 6
Joined: 2023-01-02
As far as I know, none of my code is run when this error is occurring, so yes, I'll have to look for a long-term effect issue. Good input. Thanks.


Does this error message ring any bells for you?

"Add-in execution error. Outlook crashed during the 'Activate' callback of the 'ExplorerEvents' interface while calling into the 'QnE' add-in."

Any Add-In Express component that would get an event called for 'Activate' on the ExplorerEvents interface?

Thanks again,
TJ
Posted 04 Jan, 2023 17:07:43 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello TJ,

I'm sorry for the delay; it took a while to get a developer knowing this area.

There's TadxAddin.DoExplorerActivate(ASender: TObject); see adxAddIn.pas. That code works twenty years or so.

Does turning other COM off change the situation? Do you have such an event procedure in your code?

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Jan, 2023 06:25:21 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello TJ,

Please pay attention to this topic in the ADX.NET forum:

https://www.add-in-express.com/forum/read.php?PAGEN_1=4&FID=5&TID=16470

It describes sporadic crashes that resemble your case. The topic ends with our suggestion to create a test add-in using suggestions from the developers involved, so that we could test that add-in in all our test environments. This proposition is extended to you and your case. So, please consider providing us with information on how we can implement the UI and other Outlook-relates details of your add-in on our side.

We have this idea: there's an Outlook property (or method), accessing which in a certain event makes Office feel bad; the crash occurs later when the add-in accesses this or some other property possibly related to the first one.

This idea is based on our practice. We had a similar issue: the Add-in Express code accessed CurrentView(?) in certain event after we accessed some other property related to views in another event. Calling CurrentView caused a crash.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Jan, 2023 09:41:06 Top
TJ Oosterkamp




Posts: 6
Joined: 2023-01-02
Hey Andrei,

I'm sorry for the delay; it took a while to get a developer knowing this area.


No worries, and my apologies for the delay on my side, too 😊



There's TadxAddin.DoExplorerActivate(ASender: TObject); see adxAddIn.pas. That code works twenty years or so.
Does turning other COM off change the situation? Do you have such an event procedure in your code?


I don't know what you mean by 'turning other COM off' - can you please elaborate a bit?

I have one TAddInModule with code in the event handlers for OnAddInFinalize, OnAddInInitialize, and OnAddInStartupComplete.
It does not have any code for OnOLExplorerActivate, or any other event handler.

The AddInModule contains a TadxOlExplorerCommandBar that exposes no events.

And it contains a TadxOlFormsManager with no code in any event handler.

To me it seems that this is a plain vanilla add-in. No other strange COM type libraries or anything like that.

TJ
Posted 14 Jan, 2023 09:32:18 Top
TJ Oosterkamp




Posts: 6
Joined: 2023-01-02
Andrei,

Based on the instructions in this post: https://www.add-in-express.com/forum/read.php?FID=1&TID=16480&MID=85590#postform, I have updated my Outlook to this version:
Microsoft??? Outlook??? for Microsoft 365 MSO (Version 2212 Build 16.0.15928.20196) 32-bit

If it still keeps crashing, I'd be happy to share my code with you. I just need to spend some time untangling it from my own library of support functions, before I can do that.

Find in Files doesn't show any instances of 'CurrentView' of 'ItemSend' in my code.

I find my add-in crashes almost predictably when I open an archive folder with a large amount of emails (around 19k), then press Ctrl+E and start type the first couple of characters of the item I'm searching for. I guess it crashes > 60% of the time.

Let's hope this new 2212 build of Outlook just fixes it right away :)

Best,
TJ
Posted 14 Jan, 2023 10:01:17 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello TJ,

Waiting for your code or a fix from the Outlook team.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jan, 2023 07:37:23 Top