Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Dictionary<K,V> to XsdDataContractExporter adds KeyValuePair<K,V> as well #67949

Closed
mconnew opened this issue Apr 13, 2022 · 2 comments
Closed

Comments

@mconnew
Copy link
Member

mconnew commented Apr 13, 2022

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.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 13, 2022
@StephenMolloy StephenMolloy removed the untriaged New issue has not been triaged by the area owner label May 12, 2022
@StephenMolloy
Copy link
Member

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"

@ghost ghost locked as resolved and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants