Description
Description
When adding Dictionary<K,V>
to XsdDataContractExporter, it also implicitly adds KeyValuePair<K,V>
to the set. This is causing extra schema to be added when generating a WSDL in CoreWCF compared to .NET Framework.
Reproduction Steps
Add Dictionary<string,string>
to XsdDataContractExporter then export all the schema.
Expected behavior
The schema will only contain an entry for ArrayOfKeyValueOfstringstring
which corresponds to Dictionary<string,string>
.
Actual behavior
The schema contains an entry for ArrayOfKeyValueOfstringstring
and KeyValuePairOfstringstring
(which corresponds to KeyValuePair<string,string>
).
Regression?
This is a regression from .NET Framework.
Known Workarounds
Search for that schema in the resulting schema set and remove it.
Configuration
No response
Other information
The problem is caused by the code here which doesn't exist on .NET Framework. There is a comment that says this is needed for serializing JSON. This comment is obviously not correct as serializing JSON works fine on .NET Framework without this. I looked at the history and this code was there when .NET Core was open sourced and released on GitHub. I suspect this is some old code left over from when the code was originally ported from the silverlight version of .NET.