title: System.InvalidCastException when creating a client activated object using an older version of an interface defined in a strong named assembly
body: <p>I have a query about .Net Remoting, versioning and creating client activated objects.</p>
  
  <p>Here is the scenario:</p>
  
  <p>There are 2 interfaces, residing in their own assembly “SharedTypes”: IServer and IAccount. IServer contains methods “GetStatus” which returns a string, and “CreateAccount” which returns an IAccount type. This is registered into the GAC as v1.0.0.0.</p>
  
  <p>Server application references SharedTypes and implements IServer and IAccount with concrete classes,  Server and Account. These are MarshalByRefObject objects. The Server application marshals the Server class as a singleton object.</p>
  
  <p>Client application references SharedTypes and connects to the remoteable Server object through the IServer interface successfully. Here I can call GetStatus and CreateAccount (which returns a client activated object) successfully. All OK so far.</p>
  
  <p>Now I increment the version of SharedTypes to v2.0.0.0 and register into the GAC, removing the old v1.0.0.0 version.</p>
  
  <p>The Server application is built against this version, but the client is not.</p>
  
  <p>Now when I run the client application, it will as expected complain with a System.IO.FileNotFoundException, i.e. it could not find v1.0.0.0 of SharedTypes in the GAC.</p>
  
  <p>If I copy v1.0.0.0 of SharedTypes in the exe directory of the client, the client application eventually binds to this (after GAC lookup was unsuccessful). The client application starts and I can call the GetStatus on the IServer object successfully (through the singleton object). However, if I call CreateAccount – which should return a client activated object, I get the following exception:</p>
  
  <pre><code>System.InvalidCastException: Return argument has an invalid type.
     at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
     at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
     at SharedTypes.IServer.GetAccount()
  </code></pre>
  
  <p>My question is why does calling GetStatus on the server activated singleton object from the client (which is using v1.0.0.0) not throw this exception, whereas creating the client activated object through CreateAccount does? Since both types are created on the server, I would have thought that GetStatus call would have resulted in the same exception?</p>