title: WCF Client Exception: error while trying to deserialize parameter
body: <p>I am getting this error when I try to call a WCF Service:</p>
  
  <blockquote>
    <p>The formatter threw an exception while trying to deserialize the 
    message: There was an error while trying to deserialize parameter 
    <a href="http://tempuri.org/%3aResultValue" rel="nofollow">http://tempuri.org/:ResultValue</a>. The InnerException message was 'Error 
    in line 1 position 1741. Element 
    'htp://schemas.microsoft.com/2003/10/Serialization/Arrays:anyType' 
    contains data from a type that maps to the name 
    'htp://schemas.datacontract.org/2004/07/DataAccess:Person'. 
    The deserializer has no knowledge of any type that maps to this name. 
    Consider using a DataContractResolver or add the type corresponding to 
    'Person' to the list of known types - for example, by using the 
    KnownTypeAttribute attribute or by adding it to the list of known types 
    passed to DataContractSerializer.'.  </p>
  </blockquote>
  
  <p>I have a Interfaces project with the following definitions:</p>
  
  <pre><code>public interface IPerson
  {
      string Name { get; set; }
  }
  
  public interface IPersonExtended : IPerson
  {
      // If I remove the List of IPerson property, it works fine
      List&lt;IPerson&gt; Contacts { get; set; }
  }
  </code></pre>
  
  <p>I have a DataAccess project that implements the interfaces:</p>
  
  <pre><code>public class Person : IPerson
  {
      public string Name { get; set; }
  }
  
  public class PersonExtended : IPersonExtended
  {
      public string Name { get; set; }
      private List&lt;IPerson&gt; mContacts = new List&lt;IPerson&gt;();
  
      // If I remove the List of IPerson property, it works fine
      public List&lt;IPerson&gt; Contacts
      {
          get { return mContacts; }
          set { mContacts = value; }
      }
  }
  </code></pre>
  
  <p>My Service Contract looks like this:</p>
  
  <pre><code>[ServiceContract]
  [ServiceKnownType(typeof(Person))]
  [ServiceKnownType(typeof(PersonExtended))]
  public interface IMyService
  {
      [OperationContract]
      ServiceCallResult&lt;GetPeopleResponse&gt; GetPeople(GetPeopleRequest request);
  }
  </code></pre>
  
  <p>My Service looks like:</p>
  
  <pre><code>public class MyService : IMyService
  {
      public ServiceCallResult&lt;GetPeopleResponse&gt; GetPeople(GetPeopleRequest request)
      {
          GetPeopleResponse response = new GetPeopleResponse();
          // Get Some people that have contacts
          response.People = GetPeopleFromSomewhere();
  
         ServiceCallResult&lt;GetPeopleResponse&gt; result = 
             new ServiceCallResponse&lt;GetPeopleResponse&gt; { ResultValue = response };
  
         return result;
      }
   }
  </code></pre>
  
  <p>And my response object looks like:</p>
  
  <pre><code>[DataContract]
  [KnownType(typeof(PersonExtended))]
  [KnownType(typeof(Person))]
  [KnownType(List&lt;Person&gt;))]
  [KnownType(List&lt;PersonExtended))]
  public class GetPeopleResponse
  {
      [DataMember]
      public List&lt;PersonExtended&gt; People { get; set; }
  }
  </code></pre>
  
  <p>The Response object is just wrapped in a <code>MessageContract</code> object that contains status information, etc.</p>
  
  <p><strong>EDIT</strong>
  If I remove the Contact (List) property through the entire workflow, it works fine.  I'm wondering if it is related to trying to use a property with a list to an interface instead of a concrete object, but I'm not sure how to get around that with my project structure without adding a circular reference.</p>