C#铸造系统.__ comobject类types

我有一个Excel加载项,我目前正试图build立一个unit testing框架。 对于unit testing,我遵循这个指南: http : //blogs.msdn.com/b/varsha/archive/2010/08/17/writing-automated-test-cases-for-vsto-application.aspx

它似乎工作正常,直到我想从我的界面返回一个类对象。 指定类对象作为返回types在调用方法时抛出“返回参数具有无效types”exception。 将类的返回types更改为对象允许我调用方法并获取对象,但是现在我无法将其转换为类并按预期方式使用,因此在尝试时会得到此exception消息:

> Unable to cast COM object of type 'System.__ComObject' to class type > 'XYCoordinates'. Instances of types that represent COM > components cannot be cast to types that do not represent COM > components; however they can be cast to interfaces as long as the > underlying COM component supports QueryInterface calls for the IID of > the interface. 

我已经使用VisualBasic.Information.TypeName检索了types名称,并将其显示为我期望的类。

有没有办法让这个comobject回到课堂上? 或者另一种方式来访问它的属性? 还是我在这里有点愚蠢?