Skip to content

.Net client generate DataContract cache overflow exception when return type is nullable ValueTuple #5833

@Diesel1017

Description

@Diesel1017

Bug description

Conditions for causing an error:

  • When binding is NetTcp. (not 100% sure that only then)
  • The interface call return type is nullable valuetuple and has return value.
    e.g:
    public (double value, string textValue)? TestCall()

When return value is (12, "SomeText doesn't matter") then:

  • With .NET Framework 4.8.1: Works without errors
  • With .NET (tested with 6-8): Throws exception.

The exception:
System.ServiceModel.Dispatcher.NetDispatcherFaultException: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://Microsoft.Samples.NetTcp:ValueTupleTestResult. The InnerException message was 'An internal error has occurred. DataContract cache overflow.'. Please see InnerException for more details.'

To Reproduce

Call wcf service with .net client nullable valuetuple method.

  1. I attached a sample project. Sample.zip (Don't forget change the target to .net)
  2. The full callstack:
    System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(System.Xml.XmlDictionaryReader reader, System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo part, bool isRequest) System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(System.Xml.XmlDictionaryReader reader, System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo part, bool isRequest) System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(System.Xml.XmlDictionaryReader reader, System.ServiceModel.Channels.MessageVersion version, string action, System.ServiceModel.Description.MessageDescription messageDescription, object[] parameters, bool isRequest) System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(System.ServiceModel.Channels.Message message, object[] parameters, bool isRequest) System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(System.ServiceModel.Channels.Message message, object[] parameters) System.ServiceModel.Primitives.dll!System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ref System.ServiceModel.Dispatcher.ProxyRpc rpc) System.ServiceModel.Primitives.dll!System.ServiceModel.Channels.ServiceChannel.HandleReply(System.ServiceModel.Dispatcher.ProxyOperationRuntime operation, ref System.ServiceModel.Dispatcher.ProxyRpc rpc) System.ServiceModel.Primitives.dll!System.ServiceModel.Channels.ServiceChannel.Call(string action, bool oneway, System.ServiceModel.Dispatcher.ProxyOperationRuntime operation, object[] ins, object[] outs, System.TimeSpan timeout) System.ServiceModel.Primitives.dll!System.ServiceModel.Channels.ServiceChannel.Call(string action, bool oneway, System.ServiceModel.Dispatcher.ProxyOperationRuntime operation, object[] ins, object[] outs) System.ServiceModel.Primitives.dll!System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(System.ServiceModel.Channels.MethodCall methodCall, System.ServiceModel.Dispatcher.ProxyOperationRuntime operation) System.ServiceModel.Primitives.dll!System.ServiceModel.Channels.ServiceChannelProxy.Invoke(System.Reflection.MethodInfo targetMethod, object[] args) ProxyBuilder!generatedProxy_1.ValueTupleTest(double value, double value) client.dll!Microsoft.Samples.NetTcp.CalculatorClient.ValueTupleTest(double n1, double n2) Line 134 at D:\source\client\Connected Services\Microsoft.Samples.NetTcp\Reference.cs(134) client.dll!Microsoft.Samples.NetTcp.Client.Main() Line 41 at D:\source\client\client.cs(41)

Expected behavior
It should work the same way as in the .net framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions