Describe the bug
The "typeReuseMode": "All" option no longer works when one of the [DataMember]s of a [DataContract] is itself not a [DataContract] but instead implements the IXmlSerializable interface. This isn't the case in net472 (using the "Update Service Reference").
To Reproduce
I've created a simple repository in order to demonstrate the issue (tested with all versions up to the latest build version: 8.0.0-dev.24427.1).
The solution contains the following projects:
CommonTypes - this contians the "shared" data contracts (including the problematic CustomSerializableType contract). It is currently multi-targeting net472 and net8.0 but that's not a problem here.
SerializationTests - a simple test that demonstrates that the DataContractSerializer is capable of dealing with all of my CommonTypes
CoreWCF-Service - a .NET8 service hosting a vanilla IService returning the contracts from CommonTypes.
NetFramework-Client - a simple net472 client referencing the CommonTypes which demonstrates that the scenario used to work before.
CoreWCF-Client - a simple net8.0 client referencing the CommonTypes which demonstrates that the scenario doesn't work any more (tested using the latest build svcutil tool: 8.0.0-dev.24427.1, as well as the current version 2.2.0-preview1.23462.5)
Expected behavior
It should be possible to have one [DataContract] contain a [DataMember] that is itself not a [DataContract] but an IXmlSerializable (possibly [Serializable] as well, I'm not sure anymore), as used to be the case in .net framework.
Alternatively setting the "serializer": "DataContractSerializer" option explicitly should work, as long as the types are supported by the DataContractSerializer.
Additional context
If we removed the GetComplexValue operation from the interface, the type-reuse works once again (at least for the one remaining operation, which returns the simple contract).
Describe the bug The
"typeReuseMode": "All"
option no longer works when one of the[DataMember]
s of a[DataContract]
is itself not a[DataContract]
but instead implements theIXmlSerializable
interface. This isn't the case innet472
(using the "Update Service Reference").To Reproduce I've created a simple repository in order to demonstrate the issue (tested with all versions up to the latest build version:
8.0.0-dev.24427.1
). The solution contains the following projects:CommonTypes
- this contians the "shared" data contracts (including the problematicCustomSerializableType
contract). It is currently multi-targetingnet472
andnet8.0
but that's not a problem here.SerializationTests
- a simple test that demonstrates that theDataContractSerializer
is capable of dealing with all of myCommonTypes
CoreWCF-Service
- a .NET8 service hosting a vanilla IService returning the contracts fromCommonTypes
.NetFramework-Client
- a simplenet472
client referencing theCommonTypes
which demonstrates that the scenario used to work before.CoreWCF-Client
- a simplenet8.0
client referencing theCommonTypes
which demonstrates that the scenario doesn't work any more (tested using the latest buildsvcutil tool
:8.0.0-dev.24427.1
, as well as the current version2.2.0-preview1.23462.5
)The following json file
is passed to the svcutil using:
dotnet svcutil -u "Connected Services/ServiceReference1" -v Debug
.Here are the relevant parts of the WSDL:
And here is the "problematic" type schema:
The "xml" returned by this operation contract
should contain something like this:
Expected behavior It should be possible to have one
[DataContract]
contain a[DataMember]
that is itself not a[DataContract]
but anIXmlSerializable
(possibly[Serializable]
as well, I'm not sure anymore), as used to be the case in .net framework.Alternatively setting the
"serializer": "DataContractSerializer"
option explicitly should work, as long as the types are supported by theDataContractSerializer
.Additional context
If we removed the
GetComplexValue
operation from the interface, the type-reuse works once again (at least for the one remaining operation, which returns the simple contract).