System.RuntimeType with data contract name is not expected!!


  • Hi guys,


    I'm invoking WCF service method with following signature


    Code Snippet







    public interface IService



    void InvokePLC(string PlcAssemblyName, string Plc, string PlcMethod, object[] Params, out object ReturnValue);




    I call the method as below


    Code Snippet




    new object[] { _dataScenario, _propertyData, _expression, tp.FocusedDataRowView });



    I have added _dataScenario, _propertyData, _expression classes as knowntype shown in the code above. But when I invoke this method I get following exception


    System.ServiceModel.CommunicationException: There was an error while trying to serialize parameter The InnerException message was 'Type 'System.RuntimeType' with data contract name 'RuntimeType:' is not expected.


    I just stuck and don't know what to do. Does any have the solution? Am I missing something?

    Thursday, May 08, 2008 2:43 PM


All replies

  • I suspect this as to do with the out parameter.  Since this operation returns void anyway, why not just have it return the ReturnValue instead of using an out parameter?


    Thursday, May 08, 2008 3:04 PM
  • I get the same exception even if I return value rather using out param. However I get no error if I just send null as param value.


    But still not clear why it gives me exception if I pass param values.

    Thursday, May 08, 2008 3:13 PM

    When passing a collection as a DataContract it needs to be decorated with the CollectionDataContract attribute

    More here:

    Thursday, May 15, 2008 1:23 AM