TYPE_E_LIBNOTREGISTERED

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

TYPE_E_LIBNOTREGISTERED
Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) 
carmelo Quartarone


Guest


Some users keep on reporting the same bug. Following error message is the exception fetched from logs. Did you find a fix or a tool to solve the issue?
Version Add-in Express for Microsoft Office and .NET Professional: 9.1.4620

{"@t":"2018-10-16T10:34:35.8080198Z","@mt":"HandleUnhandledException","@l":"Error","@x":"System.InvalidCastException: Impossibile eseguire il cast di oggetti COM di tipo 'System.__ComObject' in tipi di interfaccia 'AddinExpress.MSO.IRibbonUI'. L'operazione non è stata completata perch? la chiamata QueryInterface sul componente COM per l'interfaccia con IID '{000C03A7-0000-0000-C000-000000000046}' non è riuscita a causa del seguente errore: Libreria non registrata. (Eccezione da HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).\r\n in System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)\r\n in AddinExpress.MSO.IRibbonUI.InvalidateControl(String ControlID)\r\n in AddinExpress.MSO.ADXRibbonCustomControl.Invalidate()\r\n in AddinExpress.MSO.ADXRibbonCustomControl.AddinExpress.MSO.IADXRibbonComponent.set_Caption(String value)\r\n in AddinExpress.MSO.ADXRibbonLabel.set_Caption(String value)\r\n in AndromedaAddin.ExcelAddin.MassiveUpload.WS_MassEdit.RefreshStatus(Object stateInfo)\r\n in System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)\r\n in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n in System.Threading.TimerQueueTimer.CallCallback()\r\n in System.Threading.TimerQueueTimer.Fire()\r\n in System.Threading.TimerQueue.FireNextTimers()\r\n in System.Threading.TimerQueue.AppDomainTimerCallback()","SourceContext":"AndromedaAddin.AddinModule","ExceptionDetail":{"Type":"System.InvalidCastException","HResult":-2147467262,"Message":"Impossibile eseguire il cast di oggetti COM di tipo 'System.__ComObject' in tipi di interfaccia 'AddinExpress.MSO.IRibbonUI'. L'operazione non è stata completata perch? la chiamata QueryInterface sul componente COM per l'interfaccia con IID '{000C03A7-0000-0000-C000-000000000046}' non è riuscita a causa del seguente errore: Libreria non registrata. (Eccezione da HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).","Source":"mscorlib"},"AddinVersion":"2.1.11.0","HostVersion":"15.0","HostBitness":"x86"}


Note:
Besides in version 1.xx of our add-in we did not use your Add-in Express Library and we never found this kind of issue on our clients machines
Posted 16 Oct, 2018 07:35:00 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Carmelo,

The call stack above includes a reference to a thread and this thread may be the cause of the issue as all the object models in Office are *not* thread-safe: you should call any Office object model on the main thread only.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Oct, 2018 07:41:14 Top
carmelo Quartarone


Guest


Andrei Smolin writes:
The call stack above includes a reference to a thread and this thread may be the cause of the issue as all the object models in Office are *not* thread-safe: you should call any Office object model on the main thread only.


Hello Andrei,
Ok, in this specific case the routine is started by a timer but in other cases this issue happened in routines started on the main thread. Anyway, I don't understand why the issue shows up just in few machines and not in all of them.
Posted 16 Oct, 2018 08:24:48 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
carmelo Quartarone writes:
Anyway, I don't understand why the issue shows up just in few machines and not in all of them.


There's no easy explanation to some things. There's no explanation at all to this issue; or, I don't know it. But in my practice I saw TYPE_E_LIBNOTREGISTERED generated by accessing the IRibbonExtensibility COM interface from a background thread. So, switch to using You should use System.Windows.Forms.Timer as it fires its event in the main thread.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Oct, 2018 09:44:11 Top