1

我创建了一个简单的 Office Com 加载项,它在我公司计算机上的其他 PowerPoint 加载项中使用。每次 PowerPoint 启动 AccessViolationException 时,只要我访问 AfterPresentationOpen 事件中的窗口计数属性(请参阅下面的代码),就会发生。

为了缩小问题范围,我创建了两个空白加载项解决方案(Office COM 和 VSTO 加载项)。我在 AfterPresentationOpen 方法中放置了一个断点,并且每次在名为 VSTA_Main 的线程上命中断点并引发此异常。此外,我的 try catch 块没有捕获此异常。一旦我禁用特定的第三方插件,一切都会像魅力一样工作,断点会在主线程上命中,我可以读取 count 属性。

我正在使用 Windows 7 和 Office 2010(都是 x64)。顺便说一句,在我的代码中的“VSTA_Main”线程上引发了所有其他 PowerPoint 事件。我相信实际上应该在我的 appdomain 线程上引发所有事件。

有谁知道我如何处理此错误并避免与此加载项发生任何冲突?

var windows = presentation.Windows; 
using (new ComObject(windows)) 
{ 
       try 
       {                 
        var count = windows.Count; 
        if (count == 0) 
            return; 
       } 
       catch (AccessViolationException) 
       {                 
       } 
}

请在调用堆栈下方找到。

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
4

1 回答 1

0

听起来您的加载项之一存在以下描述的线程问题:

http://www.outlookcode.com/article.aspx?id=71

于 2012-06-28T22:18:13.213 回答