There is a known issue with inheritance for COM apps in ProxyGen. The events are not inherited by the interface returned to the add-in and casting won’t fix this. The simple workaround is to add the missing inheritance to the proxy or to the descriptor file.
We have a tool AutoProxyGen which accepts add-ins. A sample add-in included with this tool corrects this problem, just add lines to the add-in indicating which type needs to inherit which type.
Tools-to-Automate-VSTA-2-Integrations-AutoProxyGen-and-Templates
ShapeAppMFC:
AddImplements("ShapeApp.Proxy.IDrawing", "ShapeApp.Proxy._IDrawingEvents")
AddImplements("ShapeApp.Proxy.IShape", "ShapeApp.Proxy._IShapeEvents")
Type to add inheritence to, Type to inherit
ShapeAppMFC:
Original:
public partial class CDrawingDoc : global::System.MarshalByRefObject, global::ShapeApp.Proxy.IDrawing, global::ShapeApp.Proxy._IDrawingEvents{} //not returned to add-in
public partial interface IDrawing{} //type returned to add-in
Fixed:
public partial class CDrawingDoc : global::System.MarshalByRefObject, global::ShapeApp.Proxy.IDrawing, global::ShapeApp.Proxy._IDrawingEvents{}
public partial interface IDrawing : global::ShapeApp.Proxy._IDrawingEvents{} //add inheritence to _IDrawingEvents to expose the events to the add-in
Posted
Jun 05 2009, 01:38 PM
by
BillL