1

I'm trying to call public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)

Now the second argument is an interface:

namespace QuickFix
{
    public interface MessageStoreFactory
    {
        MessageStore Create(SessionID sessionID);
    }  
public class MemoryStoreFactory : MessageStoreFactory {...}
}

And I'm trying to pass it an instance of the interface: msf1=QuickFix.MemoryStoreFactory() init=QuickFix.Transport.SocketInitiator(osa, msf1, ss, screenlog) but I'm getting the rather unhelpful error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: expected MessageStoreFactory, got MemoryStoreFactory

Is there some way to identify to C#/CLR that the I have passed a Python instance of a class which implements the MessageStoreFactory instance? Or is this some other, unrelated problem?

gbronner
  • 1,907
  • 24
  • 39
  • This answer argues that the specific manner in which dlls are loaded via AddReference makes a difference. http://stackoverflow.com/questions/27804885/kitchenpc-and-ironpython – gbronner Apr 13 '15 at 23:12
  • If you implemented `MemoryStoreFactory` as shown in your sample and the constructor of `SocketInitiaton` takes a `MessageSoreFactory` it should just work. Whiche IronPython version are you using? Are you sure that there are not multiple classes/interfaces with the same name and you are getting some from the wrong namespace or assembly? – Simon Opelt Apr 14 '15 at 20:11
  • I think that I may have been adding a reference to the dll twice -- eventually got it to work. Wish there was some way to determine this. IronPython 2.7.5 – gbronner Apr 14 '15 at 20:54

0 Answers0