.NET/COM Exception with IRTDUpdateEvent

1.3k views Asked by At

We built an RTD Server assembly which has been in wide use for several years. (It was built with VS 2008, .NET 3.5 Target Runtime.) Today a user reported getting the following Exception:

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.IRTDUpdateEvent'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A43788C1-D91B-11D3-8F39-00C04F3651B8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at Microsoft.Office.Interop.Excel.IRTDUpdateEvent.UpdateNotify() at EZomsRTDServer.RTDServer.NotifyExcel()

He was running fine yesterday. The problem seems to have been caused by him installing a new application which prompted him to install an .NET 4 update. (He already had .NET 4 installed, so not sure what this update was.) The user resolved the problem by rolling back to yesterday's restore point (which still was running .NET 4). But we need to understand what could have happened during an install to cause the COM compatibility problem. (He didn't touch Excel or our RTD application).

Could it be possible that one of the installs used the Guid of the IRTDUpdateEvent for some other COM class?

2

There are 2 answers

0
Sam Goldberg On BEST ANSWER

This was answered in another post: .NET RTD/COM Excel Interop errors on one user's machine?

The problem seems to have been differences between how a machine with Excel 2003 was creating this COM object, versus how a machine with Excel 2007 was creating it.

0
tomasat On

I think the reason you may be getting this error is because you are calling UpdateNotify on a thread other than the one Excel is on.

http://weblogs.asp.net/kennykerr/Rtd8

A good way to solve this is described here.

https://stackoverflow.com/a/24422419/949779