1

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?

Sam Goldberg
  • 6,711
  • 8
  • 52
  • 85
  • Hmm, no, .NET updates do not cause COM casting errors. App installers that mess with the Office PIA or the registry certainly do. – Hans Passant Oct 19 '11 at 19:29
  • @Hans: would the right approach to diagnose this be to search the registry to see if some other class got registered with the IID printed in the Exception ({A43788C1-D91B-11D3-8F39-00C04F3651B8})? – Sam Goldberg Oct 24 '11 at 18:46
  • This was answered in another post: http://stackoverflow.com/questions/10200154/net-rtd-com-excel-interop-errors-on-one-users-machine – Sam Goldberg Sep 14 '12 at 15:58

2 Answers2

1

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

Community
  • 1
  • 1
tomasat
  • 578
  • 8
  • 11
0

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.

Community
  • 1
  • 1
Sam Goldberg
  • 6,711
  • 8
  • 52
  • 85