# What replaces RubyEngine.CurrentEngine?

**URL:** <https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006>\
**Category:** IronRuby\
**Created:** [December 3, 2007, 8:24pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006 "2007-12-03T20:24:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 8:24pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/1 "2007-12-03T20:24:16Z")

</div>

Hi All, I’m updating some demos I did for [ASP.NET](http://ASP.NET) MVC. In particular my  
“ancient” IronRuby view template (rhtml) demo. You guys have been busy!  
😉

I wanted to update this wiki entry  
[http://ironruby.rubyforge.org/wiki/wiki.pl?ExecutingIronRubyFromCSharp](http://ironruby.rubyforge.org/wiki/wiki.pl?ExecutingIronRubyFromCSharp)  
And I don’t know what recplaces the line:

```
RubyEngine re = RubyEngine.CurrentEngine;

```

Could someone point me in the right direction?

Thanks!  
Phil H.

> **[You’ve Been Haacked](https://haacked.com/)**
>
> You’ve been Haacked is a blog about Technology, Software, Management, and Open Source. It’s full of good stuff.

p.s.  
Could we get a prominent link to this wiki from  
[http://www.ironruby.net/](http://www.ironruby.net/)?

p.p.s  
[http://ironruby.net/](http://ironruby.net/) doesn’t point to the same place as  
[www.ironruby.net](http://www.ironruby.net). Could someone fix the DNS? 😉

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 8:53pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/2 "2007-12-03T20:53:06Z")

</div>

Ha! I’m just preparing it in case I run out of time and need something  
else whiz-bang to demo. So if I don’t get it working, oh well. I’ll  
dance like a monkey for half an hour.

I’m using the most recent build. I grabbed from trunk and compiled.  
Unless someone has a public interface, I’ll cheat and use reflection to  
grab that. 😉

Please help! Don’t make me cheat. 🙂

Phil

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 9:09pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/3 "2007-12-03T21:09:35Z")

</div>

Hey Phil,

The way I’ve been doing it has been:

ScriptDomainManager manager = ScriptDomainManager.CurrentManager;  
LanguageProvider ruby =  
manager.GetLanguageProvider(“ruby”);  
ScriptEngine eng = ruby.GetEngine();  
RubyEngine rubyEng = ((RubyEngine)eng);

dunno if that will help you.

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 8:41pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/4 "2007-12-03T20:41:18Z")

</div>

On 12/3/07, Phil H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All, I’m updating some demos I did for [ASP.NET](http://ASP.NET) MVC.

Better get cracking; only seven hours until the demo! 😛

I don’t know the correct answer, but if you were using the most recent  
public update of the source code you could still use  
RubyEngine.CurrentEngine – you just have to work around the fact that  
it’s declared “internal”.

–  
Curt H.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 10:29pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/5 "2007-12-03T22:29:01Z")

</div>

Thanks Tomas! That got me much further. Now I get the following:

Could not load file or assembly ‘IronRuby, Version=1.0.0.0,  
Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its  
dependencies. The located assembly’s manifest definition does not match  
the assembly reference. (Exception from HRESULT: 0x80131040)

||

Line 28: {  
Line 29: ScriptDomainManager manager =  
ScriptDomainManager.CurrentManager;  
Line 30: LanguageProvider ruby =  
manager.GetLanguageProvider(“ruby”);  
Line 31: ScriptEngine eng = ruby.GetEngine();  
Line 32: RubyEngine rubyEng = ((RubyEngine)eng);

I assume that’s because I compiled IronRuby and it’s not strongly  
signed.

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/6 "2007-12-03T22:43:39Z")

</div>

Yep, I think Peter’s right. The relevant piece of code seems to be in  
Hosting\ScriptEnvironmentSetup.cs, line 139 in the DLR assembly.

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 10:53pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/7 "2007-12-03T22:53:02Z")

</div>

Odd, I tried that and still had problems. This is what fixed it for me:

LanguageProvider ruby =  
manager.GetLanguageProvider(typeof(RubyLanguageProvider));

I just explicitly passed in the type. All’s good now. Thanks for the  
help!

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 10:54pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/8 "2007-12-03T22:54:12Z")

</div>

Tomas R.:

> Yep, I think Peter’s right. The relevant piece of code seems to be in  
> Hosting\ScriptEnvironmentSetup.cs, line 139 in the DLR assembly.

Yes - this is a problem with SIGNED leaking into the project files. I  
need to modify the Rakefile to scrub SIGNED from the generated .csproj  
files that y’all use. For the time being, just remove SIGNED from the  
.csproj files and you should be good to go.

-John

---

<div class="post-metadata">

**Author:** ![technomancy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b77776/32.png) [@technomancy](https://www.ruby-forum.com/u/technomancy)\
**Post date:** [December 3, 2007, 10:36pm UTC](https://www.ruby-forum.com/t/what-replaces-rubyengine-currentengine/122006/9 "2007-12-03T22:36:38Z")

</div>

I believe there is a conditional compilation symbols called SIGNED. If  
you  
remove that from all the projects, then the language loading mechanism  
doesn’t try to use the public key. I think!

Pete

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Phil H.  
Sent: Monday,03 December 03, 2007 21:27  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] What replaces RubyEngine.CurrentEngine?

Thanks Tomas! That got me much further. Now I get the following:

Could not load file or assembly ‘IronRuby, Version=1.0.0.0,  
Culture=neutral,  
PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The located  
assembly’s manifest definition does not match the assembly reference.  
(Exception from HRESULT: 0x80131040)

Line 28: {  
Line 29: ScriptDomainManager manager =  
ScriptDomainManager.CurrentManager;  
Line 30: LanguageProvider ruby =  
manager.GetLanguageProvider(“ruby”);  
Line 31: ScriptEngine eng = ruby.GetEngine();  
Line 32: RubyEngine rubyEng = ((RubyEngine)eng);

I assume that’s because I compiled IronRuby and it’s not strongly  
signed.

Tomas R. wrote:

Hey Phil,

The way I’ve been doing it has been:

ScriptDomainManager manager = ScriptDomainManager.CurrentManager;  
LanguageProvider ruby =  
manager.GetLanguageProvider(“ruby”);  
ScriptEngine eng = ruby.GetEngine();  
RubyEngine rubyEng = ((RubyEngine)eng);

dunno if that will help you.

On 12/3/07, Phil H. [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

Ha! I’m just preparing it in case I run out of time and need something  
else whiz-bang to demo. So if I don’t get it working, oh well. I’ll  
dance like a monkey for half an hour.

I’m using the most recent build. I grabbed from trunk and compiled.  
Unless someone has a public interface, I’ll cheat and use reflection to  
grab that. 😉

Please help! Don’t make me cheat. 🙂

Phil

Curt H. wrote:

On 12/3/07, Phil H. [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

Hi All, I’m updating some demos I did for [ASP.NET](http://ASP.NET) MVC.

Better get cracking; only seven hours until the demo! 😛

I don’t know the correct answer, but if you were using the most recent  
public update of the source code you could still use  
RubyEngine.CurrentEngine – you just have to work around the fact that  
it’s declared “internal”.

–  
Curt H.  
removed\_email\_address@domain.invalid

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
