More surprises followed :). Because if now one of the inheriting ruby classes defines an initialize method then it is mapped to the initialize method of the C# base class. <div>This initialize method of my controller is totally different from the initialize method of the parent controller in C# it wouldn&#39;t be an override. Is there a way to tell IronRuby it shouldn&#39;t walk up the chain except when called super and to disregard the C# implemented method?  I tried using alias_method but that didn&#39;t help.</div>

<div><br></div><div><br></div><div>public abstract class ControllerBase { </div><div>   public virtual void Initialize(RequestContext context){</div><div>      // do stuff here</div><div>   }</div><div>}</div><div><br></div>

<div>/* More Subclasses in C# go here none override Initialize */</div><div><br></div><div><div>class Controller &lt; System::Web::Mvc::IronRuby::Controllers::RubyController</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>

<div>        # An attempt to put the base method out of play<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>alias_method :base_controller_initialize, :initialize</div>

<div><br></div><div>        # This approach had different problems</div><div><span class="Apple-tab-span" style="white-space:pre">        </span># undef_method :initialize</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>def initialize; end</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>end</div></div><div><br></div><div><div>class ApplicationController &lt; Controller</div><div><br></div><div>  def initialize(user_svc=nil)</div>

<div>    @user_service = user_svc||UserService.new(uow_scope)</div><div>  end</div><div><br></div><div>end</div><div><br></div><div>In the ApplicationController it now says that the first argument is of type RequestContext which isn&#39;t what there is supposed to be there. It should be a UserService</div>

<div><br></div><div>In this case the initialize method is not that extremely important because it was there to make unit testing easier. I can set the dependencies some other way. At this point I&#39;m more curious about how it works or will work in the future, CLR interop has been very interesting so far :)</div>

</div><div><div><br></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>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 Sun, Jul 26, 2009 at 10:34 AM, Ivan Porto Carrero <span dir="ltr">&lt;<a href="mailto:ivan@flanders.co.nz">ivan@flanders.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Thanks that did it.<div><br></div><div>The System.Web.Mvc.Controller class does have an initialize method with 1 param.<div class="im"><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>
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><br></div><div><div></div><div class="h5"><div class="gmail_quote">On Sun, Jul 26, 2009 at 2:38 AM, Tomas Matousek <span dir="ltr">&lt;<a href="mailto:Tomas.Matousek@microsoft.com" target="_blank">Tomas.Matousek@microsoft.com</a>&gt;</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><span style="font-size:11.0pt;color:#1F497D">If you want an immediate fix go to RubyClass.cs and add </span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">&amp;&amp; initializer <span style="color:blue">is</span> <span style="color:#2B91AF">RubyLibraryMethodInfo </span></span><span style="font-size:11.0pt;color:#1F497D">to the condition on line 1213:</span></p>


<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue">bool</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"> hasLibraryInitializer = !hasRubyInitializer &amp;&amp; initializer.DeclaringModule != Context.ObjectClass <span style="background:yellow">&amp;&amp; initializer <span style="color:blue">is</span> <span style="color:#2B91AF">RubyLibraryMethodInfo</span></span>;</span></p>


<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">That should do the trick.</span></p><p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p>


<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p><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>Tomas Matousek<br>


<b>Sent:</b> Saturday, July 25, 2009 5:16 PM</span></p><div><div></div><div><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] Can&#39;t create instances</div>


</div><p></p></div></div><div><div></div><div><p> </p><p><span style="font-size:11.0pt;color:#1F497D">Does any of the C# subclasses have Initialize method? That might be the problem. I’ll fix it asap.</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p><p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><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> Saturday, July 25, 2009 4:45 PM<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] Can&#39;t create instances</span></p>


<p> </p><p>It&#39;s a subclass of RubyController (<a href="http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/RubyController.cs" target="_blank">http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/RubyController.cs</a>)</p>


<div><p> </p></div><div><p>There are no constructors defined in any of the class definitions.</p></div><div><p> </p></div><div><p>HomeController.rb:</p></div><div><p><a href="http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvcWeb/Controllers/HomeController.rb" target="_blank">http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvcWeb/Controllers/HomeController.rb</a></p>


</div><div><p> </p></div><div><p>Ruby controller base class:</p></div><div><p><a href="http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/controller.rb#L360" target="_blank">http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/controller.rb#L360</a></p>


</div><div><p> </p></div><div><p>RubyController:</p></div><div><p style="margin-bottom:12.0pt"><a href="http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/RubyController.cs" target="_blank">http://github.com/casualjim/ironrubymvc/blob/f9b28881187865dcff3389231e627ee2c4f93d14/IronRubyMvc/Controllers/RubyController.cs</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>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></p><div><p>On Sun, Jul 26, 2009 at 1:30 AM, Tomas Matousek &lt;<a href="mailto:Tomas.Matousek@microsoft.com" target="_blank">Tomas.Matousek@microsoft.com</a>&gt; wrote:</p>


<div><div><p><span style="font-size:11.0pt;color:#1F497D">What is the class being created that fails?</span></p><p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">Tomas</span></p>


<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><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> Saturday, July 25, 2009 4:01 PM<br><b>To:</b> ironruby-core<br><b>Subject:</b> [Ironruby-core] Can&#39;t create instances</span></p><div><div><p> </p><p>Hi</p><div><p> </p></div><div><p>I just updated from github and ironrubymvc broke.</p>


</div><div><p> </p></div><div><p>This method would happily execute before the update.</p></div><div><p> </p></div><div><div><p>public object CreateInstance(RubyClass rubyClass)</p></div><div><p>        {</p></div><div><p>


            return Operations.CreateInstance(rubyClass);</p></div><div><p>        }</p></div><div><p> </p></div><div><p>Now it throws an exception. Do I need to change something?</p></div><div><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;"> </span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;"> </span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">ArgumentException: wrong number of arguments (0 for 1)]</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame) +58</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Interpreter.Interpreter.RunInstructions(InterpretedFrame frame) +90</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) +104</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Interpreter.LightLambda.Run2(T0 arg0, T1 arg1) +337</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   IronRuby.Runtime.Calls.InterpretedFuncDispatcher`2.Invoke(CallSite callSite, T0 arg0) +574</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +1217</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   CallSite.Target(Closure , CallSite , Object ) +414</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +1217</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Runtime.DynamicOperations.CreateInstance(Object obj, Object[] parameters) +209</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   Microsoft.Scripting.Hosting.ObjectOperations.CreateInstance(Object obj, Object[] parameters) +51</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.IronRuby.Core.RubyEngine.CreateInstance(RubyClass rubyClass) in C:\dev\ironrubymvc\IronRubyMvc\Core\RubyEngine.cs:100</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.IronRuby.Controllers.RubyControllerFactory.ConfigureController(RubyClass rubyClass, RequestContext requestContext) in C:\dev\ironrubymvc\IronRubyMvc\Controllers\RubyControllerFactory.cs:87</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.IronRuby.Controllers.RubyControllerFactory.LoadController(RequestContext requestContext, String controllerName) in C:\dev\ironrubymvc\IronRubyMvc\Controllers\RubyControllerFactory.cs:73</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.IronRuby.Controllers.RubyControllerFactory.CreateController(RequestContext requestContext, String controllerName) in C:\dev\ironrubymvc\IronRubyMvc\Controllers\RubyControllerFactory.cs:40</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7</span></pre><pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181</span></pre>


<pre><span style="font-size:11.0pt;font-family:&quot;Lucida Console&quot;">   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +75</span></pre></div><p 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>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 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> </p></div></div></div></div></div><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><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>