R169 problem

Hi,

After trying out 169, all my previously passing tests are now failing
with:

failed: System.InvalidCastException : Unable to cast object of type
‘IronRuby.Runtime.RubyTopLevelScope’ to type
‘IronRuby.Runtime.RubyContext’.
C:\Dev\ironruby\trunk\src\ironruby\Runtime\Calls\CallArguments.cs(111,0):
at IronRuby.Runtime.Calls.CallArguments.get_RubyContext()
C:\Dev\ironruby\trunk\src\ironruby\Runtime\Calls\MetaObjectBuilder.cs(137,0):
at
IronRuby.Runtime.Calls.MetaObjectBuilder.AddTargetTypeTest(CallArguments
args)
C:\Dev\ironruby\trunk\src\ironruby\Runtime\Calls\RubyCallAction.cs(108,0):
at IronRuby.Runtime.Calls.RubyCallAction.Bind(MetaObjectBuilder
metaBuilder, String methodName, CallArguments args)
C:\Dev\ironruby\trunk\src\ironruby\Runtime\Calls\RubyCallAction.cs(102,0):
at IronRuby.Runtime.Calls.RubyCallAction.Bind(MetaObject context,
MetaObject[] args)
C:\Dev\ironruby\trunk\src\Microsoft.Scripting.Core\Actions\MetaObjectBinder.cs(61,0):
at System.Dynamic.Binders.MetaObjectBinder.Bind(Object[] args,
ReadOnlyCollection1 parameters, LabelTarget returnLabel) C:\Dev\ironruby\trunk\src\Microsoft.Scripting.Core\Actions\CallSiteOps.cs(53,0): at System.Runtime.CompilerServices.CallSiteOps.CreateNewRule[T](CallSite1
site, CallSiteRule1 oldRule, CallSiteRule1 originalRule, Object[]
args)
C:\Dev\ironruby\trunk\src\Microsoft.Scripting.Core\Actions\UpdateDelegates.Generated.cs(428,0):
at
System.Dynamic.Binders.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite
site, T0 arg0, T1 arg1, T2 arg2)
at IronRuby.Classes.Template$1.CoreRender(TextWriter )
C:\Dev\nhaml\trunk\src\NHaml\Template.cs(18,0): at
NHaml.Template.Render(TextWriter textWriter)
at IronRuby.Classes.Template$1.Render(TextWriter )
at stub$17##17(Closure , CallSite , Object , Object )
C:\Dev\ironruby\trunk\src\Microsoft.Scripting.Core\Actions\UpdateDelegates.Generated.cs(299,0):
at
System.Dynamic.Binders.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite
site, T0 arg0, T1 arg1)
C:\Dev\ironruby\trunk\src\Microsoft.Scripting\Runtime\DynamicOperations.cs(83,0):
at Microsoft.Scripting.Runtime.DynamicOperations.Invoke(Object obj,
Object[] parameters)
C:\Dev\ironruby\trunk\src\Microsoft.Scripting\Hosting\ObjectOperations.cs(76,0):
at Microsoft.Scripting.Hosting.ObjectOperations.Call(Object obj,
Object[] parameters)
C:\Dev\nhaml\trunk\src\NHaml.Compilers.IronRuby\IronRubyTemplateFactory.cs(58,0):
at
NHaml.Compilers.IronRuby.IronRubyTemplateFactory.DlrShimTemplate.Render(TextWriter
textWriter)

I’m roughly using the DLR like so:

scriptEngine = Ruby.CreateEngine();
scriptEngine.Execute(templateSource);
renderAction = _scriptEngine.CreateScriptSourceFromString(className +
“.new.method(:render)”).Execute();
scriptEngine.Operations.Call(renderAction, textWriter);

– templateSource –

require ‘C:\Dev\nhaml\trunk\src\Tests\bin\Debug\NHaml.dll’
require
‘C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll’
class Templates_IronRuby_Welcome_haml<NHaml::Template
def __a(as)
as.collect { |k,v|
next unless v
“#{k.to_s.gsub(’_’,’-’)}=”#{v}""
}.compact.join(’ ‘)
end
def CoreRender(text_writer)
title = “Welcome to my ASP.NET MVC Application using NHaml!”
text_writer.Write(’<h2’)
text_writer.WriteLine(’>’)
text_writer.Write(’ ‘)
text_writer.WriteLine(title)
text_writer.WriteLine(’’)
text_writer.Write(’<p’)
text_writer.WriteLine(’>’)
text_writer.Write(’ ‘)
text_writer.WriteLine(“Yeah Baby!”)
text_writer.WriteLine(’

’)
end;end

– NHaml::Template –

public abstract class Template
{
private readonly OutputWriter _outputWriter = new OutputWriter();

public virtual void Render(TextWriter textWriter)
{
Invariant.ArgumentNotNull(textWriter, “textWriter”);

_outputWriter.TextWriter = textWriter;

PreRender(_outputWriter);
CoreRender(textWriter);

}

protected virtual void PreRender(OutputWriter outputWriter)
{
}

protected abstract void CoreRender(TextWriter textWriter);

protected OutputWriter Output
{
get { return _outputWriter; }
}
}

Any help appreciated.

Cheers,

Andrew.

Update: This is still broken on 172 except I had to change:

def CoreRender(text_writer)

to:

def core_render(text_writer)

first.

Cheers,

Andrew.

I just committed a fix for interop to our internal repository. It
should be merged out shortly.

It works now, cheers.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs