title: IronPython Lists, Tuples, Dictionaries crash WCF communications
body: <p>I am attempting to use WCF to execute IronPython remotely inside of C#. Everything in my system is functioning beautifully as long as it is local.</p>
  
  <p>I have isolated the problem to passing certain objects to the client via WCF:</p>
  
  <p>If you try to pass these to a WCF client from a WCF server, the communications channel crashes:</p>
  
  <ol>
  <li>PythonDictionaries containing values that are Tuples or Lists</li>
  <li>Tuples of any kind</li>
  </ol>
  
  <p>...Strangely, dictionaries containing dictionaries are ok (as long as the nested dictionary doesn't meet these 2 conditions). Here is my example code:</p>
  
  <pre><code>try
  {
      PythonFlow localPython = new PythonFlow();
      IPythonFlow remotePython = new IronTesterWcfClient("localhost", "8000");
  
      string tuple = "(1,2,3)";
      string list = "[1,2,3]";
      string complexDict0 = "{'a':'b','c':{'d':'f'}}";
      string complexDict1 = "{'a':'b','c':(1,2,3),'e':'e'}";
      string complexDict2 = "{'a':'b','c':[1,2,3],'d':'e'}"; 
      string complexDict3 = "{'a':'b','c':[1,2,3],'d':(1,2,3),'e':{'a':'b','c':[1,2,3],'d':(1,2,3)}}";
  
      localPython.OpenFlow(args[2]);
      //OK
      IronPython.Runtime.List list1 = localPython.PythonListFromString(list);
      //OK
      IronPython.Runtime.PythonDictionary dict0 = localPython.PythonDictionaryFromString(complexDict0);
      //OK
      IronPython.Runtime.PythonDictionary dict1 = localPython.PythonDictionaryFromString(complexDict1);
      //OK
      IronPython.Runtime.PythonDictionary dict2 = localPython.PythonDictionaryFromString(complexDict2);
      //OK
      IronPython.Runtime.PythonDictionary dict3 = localPython.PythonDictionaryFromString(complexDict3);
      //OK
      IronPython.Runtime.PythonTuple tuple1 = localPython.PythonTupleFromString(tuple);
  
      remotePython.OpenFlow(args[2]);
      //OK
      IronPython.Runtime.List list2 = remotePython.PythonListFromString(list);
      //OK
      IronPython.Runtime.PythonDictionary dict5 = remotePython.PythonDictionaryFromString(complexDict0);
      //Fail!!!
      IronPython.Runtime.PythonDictionary dict6 = remotePython.PythonDictionaryFromString(complexDict1);
      //Fail!!!
      IronPython.Runtime.PythonDictionary dict7 = remotePython.PythonDictionaryFromString(complexDict2);
      //Fail!!!
      IronPython.Runtime.PythonDictionary dict8 = remotePython.PythonDictionaryFromString(complexDict3);
      //Fail!!!
      IronPython.Runtime.PythonTuple tuple2 = remotePython.PythonTupleFromString(tuple);
  }
  catch (Exception ex)
  {
      //The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
      Console.WriteLine(ex.ToString());
  }
  </code></pre>
  
  <p>I am using NetTcpBinding with SecurityMode.None on the WCF server side... I should also mention that the python call is ultimately accessing a simple object in python which returns the result of eval()</p>
  
  <p>It's basically making it impossible to use Python with WCF. Any ideas?</p>
  
  <p>More info... I was finally able to extract the exceptions inside WCF when this happens:</p>
  
  <p>Outer Exception:</p>
  
  <blockquote>
    <p>There was an error while trying to serialize parameter <a href="http://Intel.ServiceModel.Samples:TestResult" rel="nofollow">http://Intel.ServiceModel.Samples:TestResult</a>.<br>
    The InnerException message was 'Type 'IronPython.Runtime.PythonTuple' with data contract name 'ArrayOfanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.</p>
  </blockquote>
  
  <p>Inner Exception:</p>
  
  <blockquote>
    <p>Type 'IronPython.Runtime.PythonTuple' with data contract name 'ArrayOfanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.</p>
  </blockquote>