GetFullFolderName throws COMException constantly in Outlook 2016

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

GetFullFolderName throws COMException constantly in Outlook 2016
Constant COMExceptions even with empty add-in project / fresh install 
Dave Thompson




Posts: 13
Joined: 2017-11-16
Hi Andrei,

I just followed the steps in the link you provided. Unfortunately we're still seeing the same behavior with the COM Exceptions.
Posted 27 Nov, 2017 10:27:04 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Hello Dave,

I would like to access your PC remotely. Is this possible? If yes, I suggest using TeamViewer; in this case you'll need to send me your session ID and password to the support email address.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Nov, 2017 10:41:36 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Dave,

I will be available for a remote session within the next 20-30 minutes, please.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Nov, 2017 10:44:39 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Okay. I'll try to prepare a test project and will send it to you tomorrow.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Nov, 2017 10:53:34 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Hello Dave,

I've sent you a download link to the test project by email; please check your Inbox.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Nov, 2017 03:41:25 Top
Dave Thompson




Posts: 13
Joined: 2017-11-16
Hello Andrei,

I unregistered all other COM add-ins, registered and ran the solution you sent. We encountered the COM exceptions just as before

Here are the following exceptions and the call stacks upon startup

System.Runtime.InteropServices.COMException

> AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.GetFullFolderName(object folder, bool clearFolderInterface) Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.Install() Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IDTExtensibility2.OnStartupComplete(ref System.Array custom) Unknown


System.Runtime.InteropServices.COMException

> AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.GetFullFolderName(object folder, bool clearFolderInterface) Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_BaseLogic.DoExplorerFolderSwitch() Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_BaseLogic.DoExplorerActivate() Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorersEvents_SinkHelper.DoNewExplorer(object sender, object explorer) Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IDTExtensibility2.OnStartupComplete(ref System.Array custom) Unknown


System.Runtime.InteropServices.COMException

> AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.GetFullFolderName(object folder, bool clearFolderInterface) Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_BaseLogic.DoExplorerFolderSwitch() Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_10_SinkHelper.AddinExpress.MSO.IExplorerEvents_10.FolderSwitch() Unknown





As before, after startup when I click on a folder I receive the COM error listed below

System.Runtime.InteropServices.COMException

> AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.GetFullFolderName(object folder, bool clearFolderInterface) Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_BaseLogic.DoExplorerFolderSwitch() Unknown
AddinExpress.MSO.2005.dll!AddinExpress.MSO.ADXAddinModule.OlExplorerEvents_10_SinkHelper.AddinExpress.MSO.IExplorerEvents_10.FolderSwitch() Unknown
Posted 28 Nov, 2017 11:31:07 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Hello Dave,

I've found my fault: I completely missed the fact the the issue only occurs at the debug time.

Dave Thompson writes:
In my Visual Studio Exception Settings I checked 'System.Runtim.InteropServices.COMException' under 'Break When Thrown'


After I set this flag, I reproduce a slightly different variant of the issue on my machine using the test project I sent you. The test add-in shows a Ribbon button. You click the button to invoke the GetFullFolderName() method; see the project.

As you can see, GetFullFolderName() receives a MAPIFolder representing the current folder, retrieves MAPIFolder.Parent (this is also a MAPIFolder), and reads the MAPIFolder.EntryId property of the parent folder. Then the while loop is repeated once again for the parent folder: we retrieve the current folder's parent's Parent (let's call it grandParent). The exception occurs when we access the grandParent's EntryID: there's no such property on that object. You can find out that grandParent doesn't contain many of the properties you can find on a regular MAPIFolder: Name, Description, WebViewUrL, etc. I assume, grandParent - which is the parent of the top folder in your store - is a special variant of MAPIFolder.

You see the exception because you set that flag in Exception Settings. Clear the flag or ignore the exception; it occurs correctly.

There's one more way to look at this: since the value returned by GetFullFolderName() is correct, the method works correctly.

What do you think?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Nov, 2017 06:25:58 Top
Dave Thompson




Posts: 13
Joined: 2017-11-16
Hi Andrei,

I see exactly what you're describing in the code. However, the Exception Settings doesn't impact whether I see the exception or not. Setting the flag in Exception Settings allowed me to view the Call Stack as the Exception occurred. Even without the flag set in Exception Settings I still see the following in my output window while running via Debug

Exception thrown: 'System.Runtime.InteropServices.COMException' in mscorlib.dll


Now that I understand why the Exception is being raised, it seems unlikely that it would cause any performance issues. It does however make tracking down the sources of other COMExceptions a little more tedious, especially if we're running more than one add-in at a time.

For the time being we'll just ignore these exceptions when we see them, but it would be great if we were able to identify the source of the Exception message without setting the flag for COMExceptions, whether it be simple message in the Output window or a custom Exception that extends the COMException object or a similar approach. I just try to be extremely thorough with Exception handling and seeing those messages in the Output makes me a little paranoid that my code has problems.

Thanks again for your help, I appreciate your tenacity with this issue!
Posted 29 Nov, 2017 10:50:17 Top
Andrei Smolin


Add-in Express team


Posts: 15209
Joined: 2006-05-11
Hello Dave,

Dave Thompson writes:
Even without the flag set in Exception Settings I still see the following in my output window while running via Debug


I assume you are unable to get this exception at the run time. Please confirm whether this is so or not.

If not, I would suppose you have some other setting or extension that let that exception get to the Output window. Although ignoring an exception isn't correct, *this* exception seems to be a valid one.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Nov, 2017 11:08:39 Top
Dave Thompson




Posts: 13
Joined: 2017-11-16
Hi Andrei,

I can confirm, you are correct. At run time the Exception is not observable.

Thanks!
Posted 29 Nov, 2017 11:36:09 Top