[Ironruby-core] ironruby in VB.net and rubygems

Andreas Beck mr.andreas.beck at gmail.com
Sun Jan 29 15:29:16 EST 2012


Hi,
I've just encountered the following problem:
I've installed the gem "builder" in version 2.0 via igem and it works fine.
When using it in a script first the first 2 lines are:

    require 'rubygems'
    require 'builder'

In VB.net I execute ruby code in the following way:

I linked:

    IronRuby.dll
    IronRuby.Libraries.dll
    IronRuby.Lbraries.Yaml.dll

from InstallationDirectory\Silverlight\bin\

my code which works fine with "regular" ruby code:

    Sub Main(ByVal Args As String())
        Dim rubyRuntime As Microsoft.Scripting.Hosting.ScriptRuntime
        Dim rubyEngine As Microsoft.Scripting.Hosting.ScriptEngine

        rubyRuntime = IronRuby.Ruby.CreateRuntime
        rubyEngine = rubyRuntime.GetEngine("rb")

        Dim strRuby As String

        Dim fileReader As StreamReader
        fileReader = New StreamReader(System.Environment.CurrentDirectory &
"\" & Args(0))
        strRuby = fileReader.ReadToEnd
        fileReader.Close()
        fileReader = Nothing
        rubyEngine.Execute(strRuby)
    End Sub

Now, when I compile the code the libraries I linked are copied in my output
directory as usual. And here the problem starts. When this library
IronRuby.Libraries.dll is in the directory where my programm is running,
executing the "require 'rubygems'" throws an error. It's the same when I
start ir on the command line and type it in. When I delete this library the
ruby code runs without any problem, but the VB.net program won't execute
any more. Here's the error message:

    C:/Program Files/IronRuby 1.1/Lib/ironruby/thread.rb:16:in
`load_assembly': Specified type
IronRuby.StandardLibrary.Threading.ThreadingLibraryInitializer is not a
subclass of IronRuby.Builtins.LibraryInitializer (LoadError)
    from C:/Program Files/IronRuby 1.1/Lib/ironruby/thread.rb:16
    from C:/Program Files/IronRuby 1.1/Lib/ruby/1.9.1/rubygems.rb:16:in
`require'
    from C:/Program Files/IronRuby 1.1/Lib/ruby/1.9.1/rubygems.rb:16
    from (ir):1:in `require'
    from (ir):1

The versions I use:
IronRuby 1.1.3.0 on .NET 4.0.30319.239
MS Visual Studio 2010

I desperately hope for help as I couldn't any helping post in the archives!
thanks in advance
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20120129/3c49e954/attachment.html>


More information about the Ironruby-core mailing list