Casting Objects (COM Interop) addendum

As a follow up to my last message, I wrote a small util method, as
follows:
public static class Util
{
public static T Cast(object o)
{
return (T)o;
}
}

And then try to call it from ruby:

x = Util.method(:cast).of(ICanDoStuff).call(mycomobject)

However, the Util.method(:cast).of(ICanDoStuff) fails with this error:

c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:405:in
ToType': invalid value for Class: ProxyLi b::ICanDoStuff (ArgumentError) from c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:386:inToTypes’
from
c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Builtins\MethodOps.cs:75:in
BindGenericParameters' from :0:inof’
from :0

Util.method(:cast).of(String) works fine however - is this because I’m
trying to pass in a .NET interface (which lives in an auto-generated
interop
dll built by tlbimp) rather than a class?

Any help is much appreciated

COM Interop is not supported in IronRuby. COM objects are not easily
reflectable. It can be supported. See

for how IronPython does it. However, IronRuby has not done the
equivalent work yet. We will get to it at some point, but as noted in
http://www.ironruby.net/About/Roadmap, its low priority for now as there
are more important scenarios we need to nail first.

From: [email protected]
[mailto:[email protected]] On Behalf Of Orion E.
Sent: Thursday, March 26, 2009 3:22 PM
To: [email protected]
Subject: [Ironruby-core] Casting Objects (COM Interop) addendum

As a follow up to my last message, I wrote a small util method, as
follows:

public static class Util
{
public static T Cast(object o)
{
return (T)o;
}
}

And then try to call it from ruby:

x = Util.method(:cast).of(ICanDoStuff).call(mycomobject)

However, the Util.method(:cast).of(ICanDoStuff) fails with this error:

c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:405:in
ToType': invalid value for Class: ProxyLi b::ICanDoStuff (ArgumentError) from c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:386:in ToTypes’
from
c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Builtins\MethodOps.cs:75:in
BindGenericParameters' from :0:in of’
from :0

Util.method(:cast).of(String) works fine however - is this because I’m
trying to pass in a .NET interface (which lives in an auto-generated
interop dll built by tlbimp) rather than a class?

Any help is much appreciated