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
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
Using FormattingUtilities.XsdDataContractExporter.GetRootElementName(type) throws in netcoreapp2.0 when used in ExplicitResponseTypeDecoration_WithExplicitDefaultStatus_SpecifiedViaProducesAttribute
#6235
Closed
pranavkm opened this issue
May 4, 2017
· 4 comments
Type 'Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary' cannot be serialized. Consider marking it with the DataContractAttribute attribute,and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively,you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized,and no attributes will be required.
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String message,Type type)
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.CreateDataContract(Int32id,RuntimeTypeHandletypeHandle,Typetype)atSystem.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(Int32id,RuntimeTypeHandletypeHandle,Typetype)
at System.Runtime.Serialization.DataContract.GetDataContract(RuntimeTypeHandletypeHandle,Typetype,SerializationModemode)
at System.Runtime.Serialization.XsdDataContractExporter.GetRootElementName(Typetype)
at Microsoft.AspNetCore.Mvc.Formatters.XmlDataContractSerializerOutputFormatter.CreateSerializer(Typetype)
The text was updated successfully, but these errors were encountered:
Here's the code to be inserted in XmlDataContractSerializerOutputFormatter.CreateSerializer:
// Verify that type is a valid data contract by forcing the serializer to try to create a data contractFormattingUtilities.XsdDataContractExporter.GetRootElementName(type);
Something in the code path is attempting to serialize it and it throws (which apparently worked on desktop?). Filed a bug so we can move on with the TFM conversion for the time being because we previously weren't calling this API from netcoreapp
The text was updated successfully, but these errors were encountered: