Skip to content

.NET 7 WCF Client throws exception deserializing response from .NET Framework 4.7.2 WCF Server when the response has a double with a decimal point #79092

@hlipsey

Description

@hlipsey

Description

We've upgraded one of our projects to .NET 7 because it fixes memory-related exceptions we were seeing in Blazor in .NET 6. This project needs to be able to communicate with a WCF Service hosted by an application that uses .NET Framework 4.7.2. When a service call sends a result back to the client that includes a double with a decimal point in it, an exception is thrown.

Reproduction Steps

Download source code from https://github.com/hlipsey/WCFDeserializationIssueInNET7
Open WCFClient7.sln and WCFServer472.sln
Run WCFServer472
Run WCFClient7

Expected behavior

Both calls run successfully

Actual behavior

The first call that is multiplying integers runs successfully. On the second call, an exception is thrown during deserialization of the message. The inner exception varies, but the outer exception is: System.ServiceModel.Dispatcher.NetDispatcherFaultException: 'The formatter threw an exception while trying to deserialize the message http://tempuri.org/:TheMessageType'

Regression?

This communication worked fine in .NET 6

Known Workarounds

No response

Configuration

WCF Server is running .NET Framework 4.7.2
WCF Client is running .NET 7
Builds target AnyCPU, running on an x64 machine

Not sure if the issue is specific to .NET 7 communicating with .NET 4.7.2 - I'm not familiar with using CoreWCF or ASP.NET to host it, so have not tested that.

Other information

The inner exception received changes with the data. Sometimes it says that the source is improperly formatted, sometimes it's an xml exception saying that certain elements are not closed, and sometimes it says it did not expect a character 'x'.

Seems related to #78913 and #79056

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions