How exactly are you doing this?  If I take the code you've provided and put it 
into a .cs file, compile it to a DLL, and import it I get:

IronPython 1.1b1 (1.1) on .NET 2.0.50727.312
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReference('test')
>>> import FooUser, FooConcrete1
>>> FooUser.FooInt(FooConcrete1())
1
>>> ^Z

Are you doing something different?

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Swank
Sent: Monday, April 02, 2007 3:03 PM
To: [email protected]
Subject: [IronPython] strange runtime error hosting Iron Python in C# app

Given a set of classes in a c# Library like the following:

    public interface IFoo
    {
        int Bar { get;}
    }

    public abstract class FooBase : IFoo
    {
        public abstract int Bar { get;}
    }

    public class FooConcrete1 : FooBase
    {
        public override int Bar { get { return 1; } }
    }

and a C# consumer:
       public class FooUser
    {
        public static int FooInt(IFoo a)
        {
            return a.Bar;
        }
    }

if I call FooInt from Python I'll get: "We Encountered an error: expected IFoo, 
got FooConcrete1".

I suspect the error stems from adding an assembly as a reference inside the 
python code in addition to referencing it in the C# project.  If this is the 
case, how do I make referenced assemblies visible to the hosted python module 
w/o using AddReference...?

Thanks,

Matt
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to