NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
699 stars 144 forks source link

Improve error reporting when custom Task Pane cannot be created #271

Open jozefizso opened 4 years ago

jozefizso commented 4 years ago

NetOffice should report when custom task pane defined by [CustomTaskPane] attribute cannot be created.

Sample problems:

chadknudson commented 4 years ago

I have written an AddIn using NetOfficeFw and it works great on my development machine but I am having trouble installing it on any other workstation. I have run RegAsm.exe on the .DLL and it reports "Types registered successfully" but when I launch Word it cannot create the custom task pane from my AddIn. Getting more insight with more descriptive error messages for what is behind this would definitely be helpful!

My AddIn is defined with the following attributes:

[ComVisible(true)]
[COMAddin("AutoDocsToolbox", "AutoDocs Toolbox", LoadBehavior.LoadAtStartup)]
[ProgId("AutoDocsToolbox.Addin"), Guid("6F747690-3C89-4255-B191-82CDCFAE8813")]
[CustomUI("RibbonUI.xml", true)]
[CustomPane(typeof(AutoDocsToolboxPane), "AutoDocs Toolbox", true, PaneDockPosition.msoCTPDockPositionRight, PaneDockPositionRestrict.msoCTPDockPositionRestrictNone, 460, 800)]
public class Addin : Word.Tools.COMAddin

{ ... }


AutoDocs ToolBox

An error occurend in CTPFactoryAvailable Unable to create NorseTechnologies.AutoDocs.Tools.AutoDocsToolboxPane(AutoDocs Toolbox).System.Runtime.InteropServices.COMException (0x80004005): Unable to create NorseTechnologies.AutoDocs.Tools.AutoDocsToolboxPane(AutoDocs Toolbox). ---> NetOffice.Exceptions.MethodCOMException (0x80004005): Failed to proceed Method on Office.ICTPFactory=>CreateCTP. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Unable to create specified ActiveX control.

--- End of inner exception stack trace ---

at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)

at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

at NetOffice.Invoker.MethodReturn(ICOMObject comObject, String name, Object[] paramsArray)

at NetOffice.Invoker.MethodReturn(ICOMObject comObject, String name, Object[] paramsArray)

at NetOffice.CoreMethodExtensions.ExecuteBaseReferenceMethodGet[T](Core value, ICOMObject caller, String name, Object[] paramsArray)

at NetOffice.CoreMethodExtensions.ExecuteBaseReferenceMethodGet[T](Core value, ICOMObject caller, String name, Object argument1, Object argument2)

at NetOffice.OfficeApi.Tools.CustomTaskPaneHandler.CreateCTP(Core factory, ICTPFactory taskPaneFactory, String fullName, String title, OnErrorHandler onError)NetOffice.Exceptions.MethodCOMException (0x80004005): Failed to proceed Method on Office.ICTPFactory=>CreateCTP. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Unable to create specified ActiveX control.

--- End of inner exception stack trace ---

at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)

at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

at NetOffice.Invoker.MethodReturn(ICOMObject comObject, String name, Object[] paramsArray)

at NetOffice.Invoker.MethodReturn(ICOMObject comObject, String name, Object[] paramsArray)

at NetOffice.CoreMethodExtensions.ExecuteBaseReferenceMethodGet[T](Core value, ICOMObject caller, String name, Object[] paramsArray)

at NetOffice.CoreMethodExtensions.ExecuteBaseReferenceMethodGet[T](Core value, ICOMObject caller, String name, Object argument1, Object argument2)

at NetOffice.OfficeApi.Tools.CustomTaskPaneHandler.CreateCTP(Core factory, ICTPFactory taskPaneFactory, String fullName, String title, OnErrorHandler onError)System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Unable to create specified ActiveX control.

--- End of inner exception stack trace ---

at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)

at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

at NetOffice.Invoker.MethodReturn(ICOMObject comObject, String name, Object[] paramsArray)System.Runtime.InteropServices.COMException (0x80004005): Unable to create specified ActiveX control.

OK