You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This has been addressed in the big 4.8/Core alignment PR (#71752). If anybody has been depending on this superfluous behavior, they can bring it back with an AppContext switch: "Switch.System.Runtime.Serialization.DataContracts.Auto_Import_KVP"
Description
When adding
Dictionary<K,V>
to XsdDataContractExporter, it also implicitly addsKeyValuePair<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 toDictionary<string,string>
.Actual behavior
The schema contains an entry for
ArrayOfKeyValueOfstringstring
andKeyValuePairOfstringstring
(which corresponds toKeyValuePair<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.
The text was updated successfully, but these errors were encountered: