[IronPython] Trouble calling a method on a .NET object

Orian, Helmut helmut.orian at schema.de
Thu Jun 12 09:54:58 CEST 2008

hi again,

this was just a repro. I can not change the visibility of the "Concrete"
class. The interface
and the "Base" class are the public API of this assembly. I will file a
bug on codeplex.

Thanks and keep up the great work,


Von: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] Im Auftrag von Curt
Gesendet: Mittwoch, 11. Juni 2008 18:35
An: Discussion of IronPython
Betreff: Re: [IronPython] Trouble calling a method on a .NET object

Your code works as expected if you make the "Concrete" class public
instead of internal. Please file this as an issue on CodePlex at

On Wed, Jun 11, 2008 at 6:09 AM, Orian, Helmut <helmut.orian at schema.de>

	I'm having trouble calling a method on one of my .NET objects.
	if you compile the following repro into a "test.dll":
	namespace Test {
	       public interface ISomeInterface {
	               string Greet();
	       public abstract class Base {}
	       public static class SomeFactory {
	               public static object Get() {
	                       return new Concrete();
	       internal class Concrete : Base, ISomeInterface {
	               public string Greet() {
	                       return "Hello world!";
	and try to use them:
	>>> import clr
	>>> clr.AddReference("test")
	>>> from Test import *
	>>> o = SomeFactory.Get()
	>>> print("Greet" in dir(o))
	>>> print(o.Greet())
	Traceback (most recent call last):
	 File "<stdin>", line 1, in <module>
	TypeError: expected ISomeInterface, got Base
	To me it looks like a bug regarding collection of polymorphic
	information on .NET types;
	or am I missing something?
	 An- und Abmeldung zur SCHEMA Mailingliste unter
	Users mailing list
	Users at lists.ironpython.com

More information about the Ironpython-users mailing list