[Ironruby-core] IronRuby overloaded method selection?

Tomas Matousek Tomas.Matousek at microsoft.com
Wed Feb 18 21:41:30 EST 2009

Could you try the latest build?
Also try:

host.method(:add_service_endpoint).clr_members.each { |m| puts m.to_string }

What does it print?


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards
Sent: Wednesday, February 18, 2009 5:26 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] IronRuby overloaded method selection?

I have the following C# code, which I'm trying to translate to IronRuby

var host = new ServiceHost(typeof(MyService ));
host.AddServiceEndpoint(typeof(IWcfContract), new WSHttpBinding(), new Uri("..."));

This compiles fine.

My ruby translation looks like this:

host = ServiceHost.new( MyService ) # this line works fine
host.add_service_endpoint( IWcfContract, WSHttpBinding.new, Uri.new("...") )

As far as I can tell, that's a direct translation and how it should work, but the second line always throws

wrong number or type of arguments for `add_service_endpoint' (ArgumentError)

Is it something to do with the way IronRuby resolves overloads? that method has about 8 different overloads, but I've tried
passing in strings (and all the other overload combinations), and nothing helps.

Note which may be of use: The second parameter is typed to accept System.ServiceModel.Channels.Binding, whereas the WSHttpBinding is about 3 or 4 steps down (up?) the inheritance tree from that. Could that be confusing it?

Note 2: I'm running this particular IronRuby => http://nbs.blob.core.windows.net/dlr/DLR.10369.release.zip

At any rate:
1) How can I figure out which overload IronRuby is deciding to call?
2) How can I make it select the correct overload if it's not doing so?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090218/bd2a53d1/attachment.html>

More information about the Ironruby-core mailing list