d'oh<div>Indeed after using the correct libraries things do work, imagine that...</div><div><br></div><div>Thanks.</div><div><br></div><div><br></div><div> </div><div>---<br>Met vriendelijke groeten - Best regards - Salutations<br>
Ivan Porto Carrero<br>Blog: <a href="http://flanders.co.nz">http://flanders.co.nz</a><br>Google Wave: <a href="mailto:portocarrero.ivan@googlewave.com">portocarrero.ivan@googlewave.com</a><br>Twitter: <a href="http://twitter.com/casualjim">http://twitter.com/casualjim</a><br>
Author of IronRuby in Action (<a href="http://manning.com/carrero">http://manning.com/carrero</a>)<br><br>
<br><br><div class="gmail_quote">On Mon, Nov 30, 2009 at 8:20 PM, Tomas Matousek <span dir="ltr"><<a href="mailto:Tomas.Matousek@microsoft.com">Tomas.Matousek@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">It seems that you reference IronRuby binaries built against CLR 2.0. You need to use CLR4 binaries: <a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33305" target="_blank">http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33305</a></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a> [mailto:<a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a>] <b>On Behalf Of </b>Ivan Porto Carrero<br>
<b>Sent:</b> Monday, November 30, 2009 1:08 AM<br><b>To:</b> <a href="mailto:ironruby-core@rubyforge.org" target="_blank">ironruby-core@rubyforge.org</a><br><b>Subject:</b> Re: [Ironruby-core] invoke member and dynamic binding isn't the same?</span></p>
<div><div></div><div class="h5"><p class="MsoNormal"> </p><div><p class="MsoNormal">I've included a C# project with all the files you need as attachment.</p></div><div><p class="MsoNormal"> </p></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<a href="http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3213" target="_blank">http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3213</a><br clear="all">---<br>Met vriendelijke groeten - Best regards - Salutations<br>
Ivan Porto Carrero<br>Blog: <a href="http://flanders.co.nz" target="_blank">http://flanders.co.nz</a><br>Google Wave: <a href="mailto:portocarrero.ivan@googlewave.com" target="_blank">portocarrero.ivan@googlewave.com</a><br>
Twitter: <a href="http://twitter.com/casualjim" target="_blank">http://twitter.com/casualjim</a><br>Author of IronRuby in Action (<a href="http://manning.com/carrero" target="_blank">http://manning.com/carrero</a>)<br><br>
<br></p><div><p class="MsoNormal">On Wed, Nov 25, 2009 at 6:16 PM, Tomas Matousek <<a href="mailto:Tomas.Matousek@microsoft.com" target="_blank">Tomas.Matousek@microsoft.com</a>> wrote:</p><div><div><p class="MsoNormal">
<span style="font-size:11.0pt;color:#1F497D">Can you send the entire source code that sets “Something” and then the entire C# method that accesses it, ideally a minimal repro?</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a> [mailto:<a href="mailto:ironruby-core-bounces@rubyforge.org" target="_blank">ironruby-core-bounces@rubyforge.org</a>] <b>On Behalf Of </b>Ivan Porto Carrero<br>
<b>Sent:</b> Wednesday, November 25, 2009 5:29 AM<br><b>To:</b> ironruby-core<br><b>Subject:</b> [Ironruby-core] invoke member and dynamic binding isn't the same?</span></p><div><div><p class="MsoNormal"> </p><p class="MsoNormal">
Hi</p><div><p class="MsoNormal">I have some ruby code, which through a process of instance_eval and other meta programming tricks builds an object with a method assign defined on it.</p></div><div><div><p class="MsoNormal">
</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">I have this code in C#</p></div><div><p class="MsoNormal"> </p></div><div><div><p class="MsoNormal"><b>var scope = Engine.CreateScope();</b></p></div>
<div><p class="MsoNormal"><b>scope.SetVariable("ctxt", this);</b></p></div><div><p class="MsoNormal"><b>Engine.ExecuteFile("rubyfile.rb", scope);</b></p></div><div><p class="MsoNormal"> </p></div><div>
<p class="MsoNormal">This code correctly sets a something property on this (linked with ctxt)</p></div><div><p class="MsoNormal">but when I then want to call a method on it that should exist </p></div><div><p class="MsoNormal">
</p></div><div><div><p class="MsoNormal"><b>public dynamic Something { get; set; }</b></p></div></div><div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><b>Something.assign("ivan")</b></p></div>
<div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Unhandled Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Iro</p></div><div><p class="MsoNormal">nRuby.Builtins.RubyObject' does not contain a definition for 'assign'</p>
</div><div><p class="MsoNormal"> at CallSite.Target(Closure , CallSite , Object , String )</p></div><div><p class="MsoNormal"> at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site,</p></div><div>
<p class="MsoNormal"> T0 arg0, T1 arg1)</p></div><div><p class="MsoNormal"> at BugTracker_40.Bug.Assign(String assignee) in C:\dev\ironruby-in-action\Sam</p></div><div><p class="MsoNormal">ples\BugTracker_40\BugTracker_40\Bug.cs:line 60</p>
</div><div><p class="MsoNormal"> at BugTracker_40.Program.Main(String[] args) in C:\dev\ironruby-in-action\Sam</p></div><div><p class="MsoNormal">ples\BugTracker_40\BugTracker_40\Program.cs:line 13</p></div><div><p class="MsoNormal">
</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">However the same code with:</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">var _rubyOperations = Engine.CreateOperations()</p>
</div><div><div><p class="MsoNormal">public object Something { get; set; }</p></div></div><div><p class="MsoNormal">_rubyOperations.InvokeMember(Something, "assign", "ivan") </p></div><div><p class="MsoNormal">
</p></div><div><p class="MsoNormal">does work.</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">The question is why? Is this the expected behavior? Am I missing an assembly reference (it has Ironruby.*, Microsoft.Scripting, Microsoft.Scripting.Core) </p>
</div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">---<br>Met vriendelijke groeten - Best regards - Salutations<br>Ivan Porto Carrero<br>Blog: <a href="http://flanders.co.nz" target="_blank">http://flanders.co.nz</a><br>
Google Wave: <a href="mailto:portocarrero.ivan@googlewave.com" target="_blank">portocarrero.ivan@googlewave.com</a><br>Twitter: <a href="http://twitter.com/casualjim" target="_blank">http://twitter.com/casualjim</a><br>Author of IronRuby in Action (<a href="http://manning.com/carrero" target="_blank">http://manning.com/carrero</a>)</p>
</div></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>Ironruby-core mailing list<br><a href="mailto:Ironruby-core@rubyforge.org" target="_blank">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a></p></div><p class="MsoNormal"> </p></div></div></div></div><br>_______________________________________________<br>
Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
<br></blockquote></div><br></div>