none
Conflict between Office COM add-in and VSTO add-in RRS feed

  • Question

  • Hi.

    I have created a simple Office Com add-in which is used among other PowerPoint add-ins on my company computers. Every time PowerPoint starts an AccessViolationException occurs as soon as I am accessing the windows count property in AfterPresentationOpen event (please see code below).

    In order to narrow down the issue I created two blank add-in solution (Office COM and VSTO add-in). I placed a breakpoint in AfterPresentationOpen method and every time the breakpoint is hit on a thread called VSTA_Main and throws this exception. Furthermore my try catch block does not catch this exception. As soon as I disable a specific third party addin everything works like a charm and the breakpoint is hit on the Main thread and I can read the count property.

    I am using Windows 7 and Office 2010 (both are x64). Btw all other PowerPoint events are raised on the "VSTA_Main" thread in my code. I believe all events should actually be raised on my appdomain thread instead.

    Does anyone know how I can handle this error and avoid any conflicts with this add-in?

    Thanks!

    Thomas

    var presentation = (_Presentation)hostObj; 
    var windows = presentation.Windows; 
    using (new ComObject(windows)) 
    { 
           try 
           {                 
            var count = windows.Count; 
            if (count == 0) 
                return; 
           } 
           catch (AccessViolationException) 
           {                 
           } 
    } 
    Please find below the call stack.
     	ntdll.dll!NtWaitForSingleObject()  + 0xa bytes	
     	KernelBase.dll!WaitForSingleObjectEx()  + 0x9c bytes	
     	ntdll.dll!RtlpExecuteHandlerForException()  + 0xd bytes	
     	ntdll.dll!RtlDispatchException()  + 0x38c bytes	
     	ntdll.dll!KiUserExceptionDispatcher()  + 0x2e bytes	
     	PPCORE.DLL!000007fee75fa918() 	
     	[Frames below may be incorrect and/or missing, no symbols loaded for PPCORE.DLL]	
     	PPCORE.DLL!000007fee75254ac() 	
     	PPCORE.DLL!000007fee7525475() 	
     	[Managed to Native Transition]	
    >	TestAddin.DLL!TestAddin.AddinModule.adxPowerPointEvents_AfterPresentationOpen(object sender, object hostObj) Line 116 + 0x20 bytes	C#
     	AddinExpress.MSO.2005.DLL!AddinExpress.MSO.ADXPowerPointAppEvents.DoAfterPresentationOpen(object presentation) + 0x6b bytes	
     	AddinExpress.MSO.2005.DLL!AddinExpress.MSO.ADXAddinModule.PowerPointApplicationEvents_SinkHelper.AddinExpress.MSO.IPowerPointApplicationEvents.AfterPresentationOpen(object presentation) + 0x56 bytes	
     	[Native to Managed Transition]	
     	[Native to Managed Transition]	
     	[Appdomain Transition]	
     	PPCORE.DLL!000007fee7499b05() 	
     	PPCORE.DLL!000007fee74999c5() 	
     	PPCORE.DLL!000007fee74461ec() 	
     	PPCORE.DLL!000007fee74b0ca0() 	
     	PPCORE.DLL!000007fee744256c() 	
     	PPCORE.DLL!000007fee7442519() 	
     	PPCORE.DLL!000007fee74f9988() 	
     	[Managed to Native Transition]	
     	AW PowerPoint 2010.DLL!AW_PowerPoint_2010.rbnAW.AddShapeToGallary(Microsoft.Office.Tools.Ribbon.RibbonGallery galrShapes) + 0xc6a bytes	
     	AW PowerPoint 2010.DLL!AW_PowerPoint_2010.rbnAW.rbnOW_Load(object sender, Microsoft.Office.Tools.Ribbon.RibbonUIEventArgs e) + 0xd3 bytes	
     	Microsoft.Office.Tools.Common.Implementation.dll!Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.CreateRibbon(string ribbonId, object context) + 0x139 bytes	
     	Microsoft.Office.Tools.Common.Implementation.dll!Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.GetRibbon(Microsoft.Office.Core.IRibbonControl control) + 0x104 bytes	
     	Microsoft.Office.Tools.Common.Implementation.dll!Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.Invoke(Microsoft.Office.Tools.Ribbon.RibbonComponentCallback callback, object[] args) + 0x80 bytes	
     	Microsoft.Office.Tools.Common.Implementation.dll!Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.System.Reflection.IReflect.InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) + 0xf2 bytes	
     	[Native to Managed Transition]	
     	[Appdomain Transition]	
     	MSO.DLL!000007fee40617ea() 	
     	MSO.DLL!000007fee406169b() 	
     	MSO.DLL!000007fee42f6fd2() 	
     	MSO.DLL!000007fee4423ae9() 	
     	MSO.DLL!000007fee3f85d24() 	
     	MSO.DLL!000007fee3f74b7c() 	
     	MSO.DLL!000007fee3f748e5() 	
     	MSO.DLL!000007fee4060d95() 	
     	MSO.DLL!000007fee4060c73() 	
     	MSO.DLL!000007fee405d57c() 	
     	MSO.DLL!000007fee3f8c7b8() 	
     	MSO.DLL!000007fee3f80671() 	
     	MSO.DLL!000007fee3f6d929() 	
     	MSO.DLL!000007fee3f80476() 	
     	MSO.DLL!000007fee3f80386() 	
     	MSO.DLL!000007fee3f8024e() 	
     	MSO.DLL!000007fee3f7f038() 	
     	MSO.DLL!000007fee3f7e7cc() 	
     	MSO.DLL!000007fee3f7d4aa() 	
     	MSO.DLL!000007fee3f7e56b() 	
     	MSO.DLL!000007fee3f8114c() 	
     	PPCORE.DLL!000007fee73ff6d5() 	
     	PPCORE.DLL!000007fee73f86ad() 	
     	PPCORE.DLL!000007fee73f6eac() 	
     	PPCORE.DLL!000007fee73f6c4d() 	
     	PPCORE.DLL!000007fee73f6120() 	
     	user32.dll!UserCallWinProcCheckWow()  + 0x11d bytes	
     	user32.dll!CallWindowProcAorW()  + 0x78 bytes	
     	user32.dll!CallWindowProcW()  + 0x18 bytes	
     	comctl32.dll!CallOriginalWndProc()  + 0x1d bytes	
     	comctl32.dll!CallNextSubclassProc()  + 0x8c bytes	
     	comctl32.dll!DefSubclassProc()  + 0x7c bytes	
     	MSO.DLL!000007fee3f2afba() 	
     	MSO.DLL!000007fee3f2a34a() 	
     	comctl32.dll!CallNextSubclassProc()  + 0x8c bytes	
     	comctl32.dll!MasterSubclassProc()  + 0xe7 bytes	
     	user32.dll!UserCallWinProcCheckWow()  + 0x11d bytes	
     	user32.dll!DispatchClientMessage()  + 0x5f bytes	
     	user32.dll!__fnDWORD()  + 0x2d bytes	
     	ntdll.dll!KiUserCallbackDispatcherContinue() 	
     	user32.dll!ZwUserMessageCall()  + 0xa bytes	
     	user32.dll!SendMessageWorker()  - 0x44b8 bytes	
     	user32.dll!RealDefWindowProcWorker()  - 0x4efc bytes	



    • Edited by TRT123 Tuesday, June 26, 2012 9:38 AM edit my question
    Monday, June 25, 2012 2:01 PM

All replies

  • Hi TRT123,

    Thank you for posting in the MSDN Forum.

    I'll involve some experts who are more familiar with your issue. This may take some time.

    Much appreciate for your patient and understanding.

    Best regards,
    Quist


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 27, 2012 5:21 AM
    Moderator
  • Hi Quist,

    Your help is very much appreciated.

    Best,
    Thomas

    Wednesday, June 27, 2012 12:53 PM
  • Hi TRT123,

    The problem is between your add-in and its interaction with PowerPoint when another third party add-in is loaded. You state that the problem doesn’t happen if that add-in is disabled. Could it be a conflict between accessing the windows.count property in each of the two add-ins?

    If you refer the issue to Microsoft Paid Support the guidance from the support engineer will be to involve the developer of the third party add-in.  If you can contact the other developer consider working jointly to trace the activity of the two add-ins when PowerPoint is loaded, or ask him for a general description of the architecture and logic flow of the code in his add-in.

    Please visit the below link to see the various paid support options that are available to enlist the support of a Microsoft Support Engineer.
     
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone


    Please remember to mark the replies as answer if they help and unmark them if they provide no help. and click "Vote as Helpful" this and other helpful posts, so other users will see your thread as useful. Best Regards, Chris Jensen

    Wednesday, June 27, 2012 7:18 PM
    Moderator
  • Hi Chris,

    The other add-in is loading a presentation when PowerPoint starts and probably closes the presentation before I can read the windows count property. As a workaround I am checking the presenation name and return if the name is equal to a specific name which seems to help to avoid this error.

    However I have noticed that my addin is created on the Main thread but all PowerPoint events occur on the VSTA_Main thread. I thought each add-in lives in there own appdomain and therefore on his own thread. I believed during an appdomain transition all calls will be marshalled to my add-in thread. Is this correct, or am I mistaken?

    Thursday, June 28, 2012 10:57 AM
  • Hi TRT123,

    I don’t have an answer for your question. Can you share a pointer or pointers to sources where you learned the information about add-in threads and domains.


    Please remember to mark the replies as answer if they help and unmark them if they provide no help. and click "Vote as Helpful" this and other helpful posts, so other users will see your thread as useful. Best Regards, Chris Jensen


    Thursday, June 28, 2012 5:36 PM
    Moderator