[Ironruby-core] IronRuby & DynamicObject.TryGetMember returning null

Benjamin Joldersma lists at ruby-forum.com
Fri Sep 9 20:44:27 EDT 2011

Okay, very interesting stuff.  I had seen you and others suggest that in 
other places, but I thought I was insulated from it, because I *was* 
implementing TryInvokeMember!  After further examination, I seem to have 
stumbled to a solution.

In my actual code, I was trying to return a function delegate in the 
TryGetMember, when the member in question is a method.  I think that 
this, coupled with the TryInvokeMember implementation was causing some 
badness.  So I removed the delegate creation code in TryGetMember, and 
just handle properties, and then in TryInvokeMember, I handle both 
methods and properties (this seems to work!)

Thanks a million for your help!

Next problem: I'm hesitant to bring it up again, maybe I should be able 
to figure this out on my own, but it's stumped me for quite a spell now. 
I'm getting a System.InvalidOperationException that says "No coercion 
operator is defined between types 'System.String' and 
'IronRuby.Builtins.MutableString'" when I try and call a method on one 
of my dynamic objects with a literal Ruby string.

I've created another gist that reproduces the problem here:


If I write 'test'.to_clr_string, this works, but that seems like kind of 
a pain to have to do in my scripts...

Any ideas about this?  The difficult part about it is that it doesn't 
even seem the runtime even gets to the point where any of my overrides 
are executed - no breakpoints are hit in MonoDevelop, no console output, 
so I don't think I can fix it from that vantage point...  Any help is 
much appreciated.



Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list