PlugIns? (#2) - OverlayEventSink? failing (#143) - Message List
I'm creating a .NET overlay for PFPS 4.3 beta 4 and am having issues with the OverlayEventSink?. The IFvOverlay interface has the event sink class show up as an 'object' in C# because it is defined as IUnknown. Looking at the ICD, it shows that this object is supposed to expose two interfaces. The first is IDisplayChangeNotifyEvents and the second is IMapChangeNotifyEvents.
When attempting to use the following code to invalidate the overlay an error occurs:
var displayChange = (IDisplayChangeNotifyEvents)_overlayEventSink; displayChange.InvalidateOverlay?()
The text of the error is:
Unable to cast COM object of type 'System.ComObject' to interface type 'FalconViewOverlayLib?.IDisplayChangeNotifyEvents'. This operation failed because the QueryInterface? call on the COM component for the interface with IID '{C644ECCA-106A-4DD8-9224-6F8BD10212B3}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Looking at the TLB and the code from svn here, this should be working.
-
Message #281
I would make sure the FalconViewOverlay?.tlb type library is registered. We do something similar in one of our C# plug-ins:
public object OverlayEventSink { set { m_displayChangeNotifyEvents = value as IDisplayChangeNotifyEvents; } }george.menhorn04/11/10 16:02:24 (3 years ago) -
Message #283
I've checked those things already, the 'as' operator is returning null when used instead the exception when it is used instead of a direct cast.
smitcham04/12/10 08:53:22 (3 years ago) -
Message #292
Just to close the loop here and get the information into the record. The issue was not related to the COM signatures at all, but was actually caused by an event handler running on a background thread attempting to call the COM object. I forced the call to be invoked on the UI thread and it is now working correctly.
smitcham04/21/10 09:11:09 (3 years ago)

