[Ironruby-core] Dynamic Binding fails if abstract event not implemented

Xerxes Battiwalla xerxesb at gmail.com
Tue Jun 23 00:03:58 EDT 2009

Hi - I've just downloaded the latest IR source from GitHub and have a
problem with what looks like a regression from v0.4.

We have an interface defining an event which is implemented by an
abstract class in C#. In Ruby, we create an implementation of the
abstract class and call only a subset of methods as we require them.
The 0.4 version played nicely and would only do the dynamic binding of
methods we required at the time we called them, however the latest
version of IR seems to try and bind the event (even though we don't
hook up to it) and can't find an implementation in ruby so it throws a
TypeLoadException citing the adder for the event does not have an

A reproducible case is pasted below. Hoping someone would be able to
shed light on whether this is intentional, and if so what we can do to
implement the event in ruby.

using System;

namespace HelloWorldApp
    public interface IHelloWorld
        event EventHandler SomeEvent;

    public abstract class AbstractHelloWorld : IHelloWorld
        public abstract event EventHandler SomeEvent;

require "HelloWorldApp.dll"

class HelloWorlder < HelloWorldApp::AbstractHelloWorld

@hello_app = HelloWorlder.new #barf

D:\source\dotnet\IronRubyInteropBug>ir ruby_test.rb
mscorlib:0:in `_TermCreateClass': Method 'add_SomeEvent' in type
'IronRuby.Classes.AbstractHelloWorld$1' from assembly
'Snippets.scripting, Version=, Culture=neutral,
PublicKeyToken=null' does not have an implementation.
        from mscorlib:0:in `CreateTypeNoLock'
        from mscorlib:0:in `CreateType'
        from c:\IronRuby\ndp\fx\src\Core\Microsoft\Scripting\Actions\DynamicMetaObjectBinder.cs:107:in
        from c:\IronRuby\ndp\fx\src\Core\Microsoft\Scripting\Actions\CallSiteBinder.cs:85:in
        from ruby_test.rb:6

Any assistance appreciated - cheers!


More information about the Ironruby-core mailing list