none
Error in calling WCF service- The value of this argument must be positive. Parameter name: size Actual value was 0. RRS feed

  • Question

  • Hi,

    I have a WCF client / server application. I get the exception mentioned in this post. I am using .NET Framework 4.0.

    I was wondering if there is any fix for this bug ?

    Thanks!

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/0c71eedb-6c71-4b94-97c7-332195a7eb5c/error-in-calling-wcf-service-the-value-of-this-argument-must-be-positive-parameter-name-size?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c71eedb-6c71-4b94-97c7-332195a7eb5c/error-in-calling-wcf-service-the-value-of-this-argument-must-be-positive-parameter-name-size?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c71eedb-6c71-4b94-97c7-332195a7eb5c/error-in-calling-wcf-service-the-value-of-this-argument-must-be-positive-parameter-name-size?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c71eedb-6c71-4b94-97c7-332195a7eb5c/error-in-calling-wcf-service-the-value-of-this-argument-must-be-positive-parameter-name-size?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/0c71eedb-6c71-4b94-97c7-332195a7eb5c/error-in-calling-wcf-service-the-value-of-this-argument-must-be-positive-parameter-name-size?forum=wcf

    Friday, June 24, 2016 6:47 PM

All replies

  • Here is the call stack

    Server stack trace:
       at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
       at System.ServiceModel.Channels.ConnectionStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.ServiceModel.Channels.StreamingConnectionHelper.StreamingOutputConnectionStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.ServiceModel.Channels.TimeoutStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.Xml.XmlStreamNodeWriter.UnsafeWriteBytes(Byte* bytes, Int32 byteCount)
       at System.Xml.XmlBinaryNodeWriter.UnsafeWriteArray(XmlBinaryNodeType nodeType, Int32 count, Byte* array, Byte* arrayMax)
       at System.Xml.XmlBinaryWriter.WriteArray(String prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, Int32[] array, Int32

    offset, Int32 count)
       at System.Runtime.Serialization.XmlWriterDelegator.WriteInt32Array(Int32[] value, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
       at WriteArrayOfintToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext

    context)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter,

    Object obj, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter,

    Object obj, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType,

    Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
       at WritePatternModuleToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract )
       at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter,

    Object obj, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter,

    Object obj, RuntimeTypeHandle declaredTypeHandle)
       at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver

    dataContractResolver)
       at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver

    dataContractResolver)
       at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver

    dataContractResolver)
       at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object

    graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter writer, PartInfo part, Object

    graph)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts,

    Object[] parameters)
       at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String

    action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters,

    Object returnValue, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter

    writer)
       at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BinaryMessageEncoderFactory.BinaryMessageEncoder.WriteMessage(Message message, Stream stream)
       at System.ServiceModel.Channels.StreamingConnectionHelper.WriteMessage(Message message, IConnection connection, Boolean isRequest,

    IConnectionOrientedTransportFactorySettings settings, TimeoutHelper& timeoutHelper)
       at System.ServiceModel.Channels.StreamedFramingRequestChannel.StreamedFramingRequest.SendRequest(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.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.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Friday, June 24, 2016 6:48 PM
  • Hi Radhika,

    Based on this error message, we could not check where the issue occurs, it would be helpful if you could share us your client/server code, which operation you got this error, and then we could test at our side.

    In addition, I would suggest you try .net 4.6.

    Best Regards,

    Tony


    Help each other

    Tuesday, June 28, 2016 2:34 AM