IronRuby error: Microsoft.Scripting.Actions.Calls.OverloadInfo (trying to port MEF)

谁说胖子不能爱 提交于 2019-12-24 07:04:37

问题


I'm trying to upgrade some 4 year old code from a blog post that allows IronRuby to import/export MEF parts.

The code is at: https://github.com/JogoShugh/IronRubyMef

Unfortunately, I get this error when attempting to run:

Method not found: 'Microsoft.Scripting.Actions.Calls.OverloadInfo[] 
Microsoft.Scripting.Actions.Calls.ReflectionOverloadInfo.CreateArray
(System.Reflection.MemberInfo[])

I only found one reference to this on the IronRuby forum, and sent another note. But, does anyone else have any idea what could cause this?

Thank you


回答1:


That error is normally caused when calling Object.new from a ruby script. Which should be working of course, IronRuby 1.1.3 seems to come with a bug where if you do Object.methods it actually lists :new but it fails on invocation.

The fix is somewhat simple, just prepend this to your Ruby program initialization, before any requires call:

class System::Object
  def initialize
  end
end

requires 'some/module'

# Rest of your code...

Now, when any script calls Object.new, it'll work correctly.I wrote a post about this issue: http://marcel.bowlitz.com/continuous-integration/custom-resources-in-visual-studio-test-projects
UPDATE: IronRuby 1.1.4 (found in http://github.com/IronLanguages/main) fixes this issue. You have checkout the code and build.



来源:https://stackoverflow.com/questions/13392178/ironruby-error-microsoft-scripting-actions-calls-overloadinfo-trying-to-port-m

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!