AccessViolationException in get_AttachmentSelection

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

AccessViolationException in get_AttachmentSelection
 
Sven Knauer




Posts: 6
Joined: 2016-01-21
Hi.

I have an issue which drives me crazy, I know it may not be related to the Add-in Express library, but if you have any suggestion, it would be appreciated.

The context is: Outlook addin based on your library.

On some client's machine I've got AccessViolationException calling the Outlook Explorer object get_AttachmentSelection function.

Detailed technical information follows:
---
(Inner Exception)
Date and Time:         06.11.2018 13:33:30
Machine Name:          XXXXXXXXXXXXXXXX
IP Address:            172.24.32.80
Current User:          XXXXXXXXXXXXXXXX
Application Domain:    XXXXXXXXXXXXXXXX
Assembly Codebase:     file:///XXXXXXXXXXXXXXXX.core.DLL
Assembly Full Name:    XXXXXXXXXXXXXXXX.core, Version=20.1.5.2488, Culture=neutral, PublicKeyToken=null
Assembly Version:      20.1.5.2488
Exception Source:      XXXXXXXXXXXXXXXX.core
Exception Type:        System.AccessViolationException
Exception Message:     Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
Exception Target Site: get_AttachmentSelection
---- Stack Trace ----
   Microsoft.Office.Interop.Outlook._Explorer.get_AttachmentSelection()
       XXXXXXXXXXXXXXXX.core.DLL: N 00000 (0x0) JIT
   XXXXXXXXXXXXXXXX.core.officewrappers.impl.OutlookExplorerWrapper.get_AttachmentSelection()
       XXXXXXXXXXXXXXXX.core.DLL: N 0000 (0x0) IL
   XXXXXXXXXXXXXXXX.providers.impl.ExplorerItemsProvider.GetSelectedAttachments()
       XXXXXXXXXXXXXXXX.core.DLL: N 0006 (0x6) IL
   XXXXXXXXXXXXXXXX.presenter.MailAttachmentPresenter.UpdateView()
       XXXXXXXXXXXXXXXX.core.DLL: N 0080 (0x50) IL
   XXXXXXXXXXXXXXXX.<OutlookEvents_ExplorerSelectionChange>d__44.MoveNext()
       XXXXXXXXXXXXXXXX.core.DLL: N 0141 (0x8D) IL
   System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start(stateMachine As TStateMachine&)
       XXXXXXXXXXXXXXXX.core.DLL: N 0044 (0x2C) IL
   XXXXXXXXXXXXXXXX.AddinModule.OutlookEvents_ExplorerSelectionChange(sender As Object, explorer As Object)
       XXXXXXXXXXXXXXXX.core.DLL: N 0052 (0x34) IL
   AddinExpress.MSO.ADXOutlookAppEvents.DoExplorerSelectionChange(explorer As Object)
       XXXXXXXXXXXXXXXX.core.DLL: N 0018 (0x12) IL

(Outer Exception)
Date and Time:         06.11.2018 13:33:30
Machine Name:          XXXXXXXXXXXXXXXX
IP Address:            172.24.32.80
Current User:          XXXXXXXXXXXXXXXX
Application Domain:    XXXXXXXXXXXXXXXX
Assembly Codebase:     file:///XXXXXXXXXXXXXXXX/AddinExpress.MSO.2005.DLL
Assembly Full Name:    AddinExpress.MSO.2005, Version=9.0.4610.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version:      9.0.4610.0
Exception Source:    
Exception Type:        AddinExpress.MSO.ADXExternalException
Exception Message:     An error has occurred in the code of the add-in.
---- Stack Trace ----


I checked the TypeLib and the Interface registrations of the interop library (PIA), and it seems valid.
We are using the Office interop extensively in the addin, and the fact it only came up for this call reminded me that this function wasn't implemented in the Office 2007 PIA.

What do you think, is it possible that somehow the Outlook loaded the wrong dll? How can I check that?
Is it possible if the Outlook loading the correct interop library, the library not using the correct COM object but an old one?

Thank you.
Posted 26 Nov, 2018 09:07:04 Top
Andrei Smolin


Add-in Express team


Posts: 16223
Joined: 2006-05-11
Hello Sven,

Try to call AttachmentSelection after a delay created as we describe in section Wait a Little, see the PDF file in the folder {Add-in Express}\Docs on your development PC. I would also try to get AttachmentSelection after AttachmentSelectionChange occurs (if it occurs after you select a new Outlook item).

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Nov, 2018 09:35:11 Top
Sven Knauer




Posts: 6
Joined: 2016-01-21
Hi Andrei,

thank you for your quick answer.

Unfortunately I cannot reproduce this issue, and every test takes a long time to manage.
Could this explain why it not comes for every client, but a several ones? Shouldn't it occur on every client?

You give me a good idea how to test if it is a timing issue, if I put a test button on the ui and on the button's click event I try to use the interop call. If it is working, it must be a timing issue.
Posted 26 Nov, 2018 09:49:23 Top
Andrei Smolin


Add-in Express team


Posts: 16223
Joined: 2006-05-11
Hello Sven,

I don't know. This may be different Outlook builds used or different sets of COM add-ins. Depending on the implementation of the AttachmentSelection object, this may be caused by something non-trivial such as IE settings.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Nov, 2018 02:55:12 Top