none
Problem with serialization of objects

    Question

  • When I try to return a collection (an List<>) of a complex kind of object (each one have about 20-30 custom objects inside) I get this error:

    Test method SMILTest.ServiceManagerTest.PessoasTest threw exception:  System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Security.SecuritySessionClientSettings`1+ClientSecurityDuplexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is in the Faulted state..

    Server stack trace:
       at System.ServiceModel.Channels.CommunicationObject.ThrowIfFaulted()
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurityDuplexSessionChannel.TryReceive(TimeSpan timeout, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at HGM.ERP.ServiceContractInterfaces.Cadastros.ICadastros.PessoasConsultar(PessoasDFO filtro)
       at SMILTest.ServiceManagerTest.PessoasTest() in C:\VSS\ERP\Service Manager Infrastructure Library\SMILTest\ServiceManagerTest.cs:line 116

    If I try to receive up to 5 objects there's no error but 6 or more objects will throw the error described. The full object graph in this case should have up to 180 (6 * 30) objects and about 10 KB. I try to set "OperationBehavior.MaxItemsInObjectGraph" and MaxReceivedMessageSize to Int32.MaxValue for test but I could send up to 5 objects.

    As I'm using a NetDataContractSerializer instead the default DataContractSerializer I just test it with the WCF default DataContract and the error is the same.
    Thursday, October 11, 2007 1:30 PM

All replies

  • you can enable tracing and see the detailed exception on server and that might help

    http://msdn2.microsoft.com/en-us/library/ms751526.aspx

     

     

    Thursday, October 11, 2007 6:56 PM
    Moderator
  • Hi Max,

     

    Have you reached a resolution for your problem?

     

    Thanks,

    -Yavor

    Tuesday, October 16, 2007 12:04 AM
  • I am finding this proplem while using WCF

     

    System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Security.SecuritySessionClientSettings`1+ClientSecurityDuplexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is in the Faulted state..

    The trace file does not give any clues to the problem and we are also setting the

    MaxReceivedMessageSize to

    40000000, while dataset is not that big

     

    Jothi

    Thursday, November 15, 2007 9:15 PM
  • Hi Guys, were you able to fix the issue.....

    • Proposed as answer by Eyhler Thursday, December 23, 2010 12:15 PM
    Tuesday, September 28, 2010 3:30 PM
  • I have the same issue while transfering complex objects. My problem was the MaxItemsInObjectGraph property of the DataContractSerializer (or NetDataContractSerializer if you are so inclined).

     
    The problem is described here http://infosysblogs.com/microsoft/2006/12/ and Sowmy Srinivasan has a programmatic solution here http://blogs.msdn.com/sowmy/archive/2006/03/26/561188.aspx.
     
    Also the increasing of binding.maxDepth may help if you transfer objects with deep nesting. Set the value more than default value of 32.
    Thursday, December 23, 2010 12:26 PM
  • You have to add the[DataContract] above your complex object!

    Try to return a List<string> i bet you wont see this exception

    Tuesday, November 13, 2012 6:39 AM