Word Hangs: opening DOC files in rapid succession

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

Word Hangs: opening DOC files in rapid succession
Crasher bug 
Andrei Smolin


Add-in Express team


Posts: 14121
Joined: 2006-05-11
Hi John,

May I ask you to specify the service packs of Windows XP and Office 2007?

I've found the following problems in your code:

1.
            if (this.OutlookApp != null)
            {
                if (OutlookApp.ActiveInspector() == null)
                    return;
            }


You should assign the value returned by ActiveInspector() to a variable, check if the variable is null and then release the variable via Marshal.ReleaseComObject(theVariable).

2. The same problem can be found in OnDocumentProfiled. Note that the Inspector.CurrentItem object should be released, too.

3. In AfterDocumentConverted, OnDocumentConvert and adxRibbonFileSave_OnAction, you access *.Active* properties of several host applications; all values returned by that properties should be released.

I'd like that simplify your code so that it would be possible to attribute the issue to the Add-in Express code or to some problems in your code; say, we suspect that our code showing custom panes in Word may have some problems showing itself in your case.

But a non-released COM object may cause the issue, too. If you wish I could look for potential problems in ComUtilsWrapper.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Oct, 2010 07:00:18 Top
John Viele




Posts: 20
Joined: 2010-09-30
I'm currently focused on testing with Windows XP v5.1 sp3 (build 2600.xpsp_sp3_gdr.100427-1636) and Office 2010 version 14.0.4760.1000 (32-bit). I'll look at the code you mentioned.
Posted 25 Oct, 2010 09:39:02 Top
John Viele




Posts: 20
Joined: 2010-09-30
Posted 25 Oct, 2010 12:55:26 Top
Andrei Smolin


Add-in Express team


Posts: 14121
Joined: 2006-05-11
Hi John,

That post describes an issue that may occur if you are developing add-ins for Visual Studio (not for Office!) and migrate the code of your add-in to VS 2010. Because they re-wrote some components in VS 2010, the code of your VS add-in that accessed a COM class defined in VS 2005-2008 is now applied to the managed implementation of the same COM class. A manifestation of an error that scenario is the following error message: "The object's type must be __ComObject or derived from __ComObject."; it occurs because Marshal.ReleaseComObject is applied to what isn't a COM object anymore.

As to your case, please read my post When to release COM objects in Office add-ins developed in .NET.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Oct, 2010 02:16:14 Top
John Viele




Posts: 20
Joined: 2010-09-30
Andrei Smolin wrote:
Hi John,

...

I've found the following problems in your code:


Andrei,

Are those the only problems you noted? I fixed those some time ago and it did not affect this issue at all as far as I can tell.
Posted 09 Nov, 2010 13:16:57 Top
Andrei Smolin


Add-in Express team


Posts: 14121
Joined: 2006-05-11
Hi John,

I've reviewed your add-in module. Although I cannot find other suspicious things, this doesn't mean there are no such things. I suggest that you commented blocks of your code in order to isolate the issue. Say, will the add-in replicating the UI of your add-in demonstrate the same behavior?

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2010 09:36:32 Top