# Interface methods of internal class not defined in IR

**URL:** <https://www.ruby-forum.com/t/interface-methods-of-internal-class-not-defined-in-ir/167654>\
**Category:** IronRuby\
**Created:** [May 11, 2009, 7:50am UTC](https://www.ruby-forum.com/t/interface-methods-of-internal-class-not-defined-in-ir/167654 "2009-05-11T07:50:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xerxesb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/da6949/32.png) [@xerxesb](https://www.ruby-forum.com/u/xerxesb)\
**Post date:** [May 11, 2009, 7:50am UTC](https://www.ruby-forum.com/t/interface-methods-of-internal-class-not-defined-in-ir/167654/1 "2009-05-11T07:50:24Z")

</div>

Hi there,

We are using a .NET library which comprises of several classes marked  
internal where each class exposes functionality through an interface.  
When attempting to call on these objects in IR, we get an “undefined  
method” exception. Is there a way to access the interface members of  
the class when it’s internal?

I’ve created the following example to reproduce:

\*\*\*\*\*\*\* In C#:

using System;

namespace HelloWorldApp  
{  
public class HelloFactory  
{  
public IHelloWorld NewWorld()  
{  
return new HelloWorld();  
}  
}

```
public interface IHelloWorld
{
    void SayHello();
}

internal class HelloWorld: IHelloWorld // NOTE THE INTERNAL MODIFIER
{
    public void SayHello()
    {
        throw new NotImplementedException();
    }
}

```

}

\*\*\*\*\*\*\* In Ruby:  
require “HelloWorldApp.dll”

class HelloWorldApp::HelloWorld  
def say\_hello  
puts “Hello!!”  
end  
end

@hello\_factory = HelloWorldApp::HelloFactory.new  
@hello\_app = @hello\_factory.new\_world

puts “hello\_app should be HelloWorldApp::IHelloWorld but was  
#{@hello\_app.class}”  
@hello\_app.say\_hello

* * *

In this example, I expect the system to puts “Hello!!”, but instead it  
throws the “undefined method” exception. If I run IR with the  
PrivateBindings option it works, but it seems like a workaround I  
shouldn’t have to do, because i’m passing the instance from C# to IR  
as the interfaced type (my conclusion therefore being it should be  
able to access it)

Any help appreciated.

Thanks,  
Xerx.

---

<div class="post-metadata">

**Author:** ![xerxesb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/da6949/32.png) [@xerxesb](https://www.ruby-forum.com/u/xerxesb)\
**Post date:** [May 11, 2009, 8:53am UTC](https://www.ruby-forum.com/t/interface-methods-of-internal-class-not-defined-in-ir/167654/2 "2009-05-11T08:53:09Z")

</div>

You are right - it should work. We know about this issue. I’ll look at  
fixing it soon, maybe this week.

Thanks,  
Tomas
