# TypeError thrown in DynamicMetaObjectBinder.Bind

**URL:** <https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078>\
**Category:** IronRuby\
**Created:** [May 3, 2009, 12:14pm UTC](https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078 "2009-05-03T12:14:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![murena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ba0ec/32.png) [@murena](https://www.ruby-forum.com/u/murena)\
**Post date:** [May 3, 2009, 12:14pm UTC](https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078/1 "2009-05-03T12:14:29Z")

</div>

Hi,  
I’m reviewing ironruby-hpricot to clean up its code but I’ve just  
noticed that something has changed in IronRuby since I last tested my  
library. Please refer to the the following gist for a simplified test  
case to reproduce the problem:

> <https://gist.github.com/nrk/105928>

I’m pretty sure this was working ~1 month ago, am I doing something  
wrong?

–  
Daniele A.  
[http://www.clorophilla.net/blog/](http://www.clorophilla.net/blog/)  
[http://twitter.com/JoL1hAHN](http://twitter.com/JoL1hAHN)

---

<div class="post-metadata">

**Author:** ![murena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ba0ec/32.png) [@murena](https://www.ruby-forum.com/u/murena)\
**Post date:** [May 3, 2009, 11:30pm UTC](https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078/2 "2009-05-03T23:30:12Z")

</div>

I think you need to do an explicit conversion to MutableString. The DLR  
used to do some automatic conversions, but now you need to be explicit.  
I don’t know what code to use so you will have to wait until someone who  
knows that can reply…

---

<div class="post-metadata">

**Author:** ![murena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ba0ec/32.png) [@murena](https://www.ruby-forum.com/u/murena)\
**Post date:** [May 4, 2009, 7:39pm UTC](https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078/3 "2009-05-04T19:39:51Z")

</div>

A couple of issues:

1. As Shri said, the return type of a site must be Object.
2. You shouldn’t be creating a new site (and also not a shared one) in  
each invocation of the method. Instead, use one of the CallSiteStorages  
defined in CallSiteStorages.cs as the first parameter. You can search in  
the built-ins for examples of usage.

Tomas

---

<div class="post-metadata">

**Author:** ![murena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ba0ec/32.png) [@murena](https://www.ruby-forum.com/u/murena)\
**Post date:** [May 4, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/typeerror-thrown-in-dynamicmetaobjectbinder-bind/167078/4 "2009-05-04T20:29:44Z")

</div>

Hi Tomas,

1. Oh, I see. I didn’t know that, and the fact that it was working  
with previous versions of IR just misleaded me.
2. Indeed, I know it was wrong to create a new site on each invocation  
and that’s exactly why I’m reviewing the oldest bits of code that  
actually interact with IronRuby to clean up everything and do it the  
right way 🙂

Thanks!

On Mon, May 4, 2009 at 19:39, Tomas M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Subject: Re: [Ironruby-core] TypeError thrown in DynamicMetaObjectBinder.Bind  
> I’m reviewing ironruby-hpricot to clean up its code but I’ve just  
> [clorophilla.net](http://www.clorophilla.net/blog/)
> 
> * * *
> 
> Ironruby-core mailing list  
> removed\_email\_address@domain.invalid  
> [http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

–  
Daniele A.  
[http://www.clorophilla.net/blog/](http://www.clorophilla.net/blog/)  
[http://twitter.com/JoL1hAHN](http://twitter.com/JoL1hAHN)
