I think it was this problem at first.
Then I tried to use only abstract classes without any interfaces. But there
In fact, it was a problem with the serialization security. You can find more
> I believe you are falling into the Interface downcast issue described by Ramor.
> Convert your IObject1 to an abstract base class and see if that helps. Of course you will then have multi-inheritance issue.
>
> Page 78 of Ramor's book says (he is talking about shared interfaces)
> "...disadvantage to using this process (share interface classes) of sharing the metadata is that you won't be able to pass those
> objects as parameters to functions running in a different context (either on the same or another server or on another client)
> because the resulting MarshalByRefObject cannot be downcast to these interfaces."
>
> He goes on the explain that the problem goes away if you convert the interfaces to abstract base classes.
>
> I can agree that abstract base classes work. I have about 10 of them in one project right now and they are being passed back and
> forth between client and server many times.
>
> HTH.
>
>
> On Thu, 18 Aug 2005 08:57:30 -0700, Fanette Ozil <FanetteOzil@discussions.microsoft.com> wrote:
>
> > Hello,
> >
> >Here is the goal of my project :
> >- to create a simplified API with helper classes for a complex software.
> >- to protect the software code by redefining a new interface.
> >
> >My project contains 3 assemblies :
> >- one that I call "interface dll", which only contains interfaces and
> >abstract classes. This dll doesn't reference any other assemblies of my
> >project. It's this dll which is on the client machine. There's no code in it.
> >
> >- one that I call "server dll" which references the interface dll. All
> >methods are implemented in it.
> >
> >- the client part, which only references the interface dll and not the
> >server dll.
> >
> >
> >My object model is :
> >
> >On the dll interface :
> >
> >public interface IObject
> >{
> > int Value
> > {
> > get;
> > set;
> > }
> >}
> >
> >public abstract class Object : MarshalByRefObject, IObject
> >{
> > public abstract int Value
> > {
> > get;
> > set;
> > }
> >}
> >
> >public interface IObject1 : IObject
> >{
> > ...
> >}
> >
> >
> >On the server dll :
> >
> >public abstract class RemoteObject : Object
> >{
> > int myValue;
> >
> > public int Value
> > {
> > get { return this.myValue; }
> > set { this.myValue = value; }
> > }
> >}
> >
> >public class RemoteObject1 : RemoteObject, IObject1
> >{
> > ...
> >}
> >
> >
> >Here is what I do to make my problem appear:
> >
> >1. The server creates a RemoteObject1 object and sends a reference of type
> >Object on it to the client. Everything works fine. The client has a reference
> >of type Object on a RemoteObject1 object. It has access to the methods
> >defined in IObject.
> >
> >2. To have access to the methods defined in IObject1, the client can cast
> >this reference of type Object in a reference of type IObject1, without
> >problem. The client has now access to the methods defined in IObject1.
> >
> >3. Then I try to pass a reference of type IObject1 on a RemoteObject1 object
> >from the client to the server as argument of a function. When doing that the
> >program does not do anything, neither on server side nor on client side. I do
> >not enter in the called method on server side. I do not catch any exception
> >either.
> >
> >What happened ?
> >
> >Thank you very much for your help
> -------------------------------------------
> Roy Chastain
> KMSYS Worldwide, Inc.
>
http://www.kmsys.com