[Ironruby-core] engine.ExecuteFile gives errors

Mohammad Azam lists at ruby-forum.com
Wed Jun 10 12:55:09 EDT 2009

I am using the following code to execute a Ruby file from C# but it
gives me the error:

 var runtime = IronRuby.Ruby.CreateRuntime();
            var engine = runtime.GetEngine("rb");


And here is the error:

Unhandled Exception: Microsoft.Scripting.SyntaxErrorException: syntax
error, une
xpected END, expecting END_OF_FILE
   at Microsoft.Scripting.ErrorSink.Add(SourceUnit source, String
message, Sourc
eSpan span, Int32 errorCode, Severity severity)
   at Microsoft.Scripting.ErrorCounter.Add(SourceUnit source, String
message, So
urceSpan span, Int32 errorCode, Severity severity)
   at IronRuby.Compiler.Parser.ReportSyntaxError(String message)
   at IronRuby.Compiler.Parser.ErrorRecovery()
   at IronRuby.Compiler.Parser.Parse()
   at IronRuby.Compiler.Parser.Parse(SourceUnit sourceUnit,
options, ErrorSink errorSink)
   at IronRuby.Runtime.RubyContext.ParseSourceCode[T](SourceUnit
sourceUnit, Rub
yCompilerOptions options, ErrorSink errorSink)
   at IronRuby.Runtime.RubyContext.CompileSourceCode(SourceUnit
sourceUnit, Comp
ilerOptions options, ErrorSink errorSink)
   at Microsoft.Scripting.SourceUnit.Compile(CompilerOptions options,

And here is the Ruby file:

class Person

def foo()
puts 'hello world'


person = Person.new()
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list