title: Why can't WCF pass an object in a dictionary?
body: <p>In my WCF service I have the object <code>QualifiedNumber</code> defined as <code>KnownType</code> and <code>ServiceKnown</code> type. If I used the <code>QualifiedNumber</code> in the following methods:</p>
  
  <p>This one does NOT work.  It throws an exception that in part reads:</p>
  
  <blockquote>
    <p>Element '<a href="http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value" rel="nofollow">http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value</a>' contains data of the '<a href="http://schemas.datacontract.org/2004/07" rel="nofollow">http://schemas.datacontract.org/2004/07</a> ServiceLibrary.Web.Model:QualifiedNumber' data contract.   The deserializer has no knowledge of any type that maps to this contract.
     cannot deserialize because the definition of QualifiedNumber is not known.</p>
  </blockquote>
  
  <pre><code>[OperationContract]
  public Dictionary&lt;int, object&gt; TestDictionaryGet()
  {
      Dictionary&lt;int, object&gt; retDict = new Dictionary&lt;int, object&gt;();
  
      retDict.Add(1, new QualifiedNumber(new decimal(1.2), "&lt;"));
      retDict.Add(2, "pass a simple string");
  
      return retDict;
  }
  </code></pre>
  
  <p>This one DOES work</p>
  
  <pre><code>public struct element
  {
      public int key;
      public object value;
  }
  
  [OperationContract]
  public List&lt;element&gt; TestElementListGet()
  {
      Dictionary&lt;int, object&gt; retDict = new Dictionary&lt;int, object&gt;();
  
      retDict.Add(1, new QualifiedNumber(new decimal(1.2), "&lt;"));
      retDict.Add(2, "pass a simple string");
  
      List&lt;element&gt; retElements = new List&lt;element&gt;();
      foreach (KeyValuePair&lt;int, object&gt; item in retDict)
      {
          element newElement;
          newElement.key = item.Key;
          newElement.value = item.Value;
  
          retElements.Add(newElement);
      }
  
      return retElements;
  }
  </code></pre>
  
  <p>What is it about the dictionary that causes the exception?</p>