diff --git a/src/Mvc/Mvc.Formatters.Xml/ref/Microsoft.AspNetCore.Mvc.Formatters.Xml.netcoreapp3.0.cs b/src/Mvc/Mvc.Formatters.Xml/ref/Microsoft.AspNetCore.Mvc.Formatters.Xml.netcoreapp3.0.cs
index fa9ffb071d..eae4a1a733 100644
--- a/src/Mvc/Mvc.Formatters.Xml/ref/Microsoft.AspNetCore.Mvc.Formatters.Xml.netcoreapp3.0.cs
+++ b/src/Mvc/Mvc.Formatters.Xml/ref/Microsoft.AspNetCore.Mvc.Formatters.Xml.netcoreapp3.0.cs
@@ -47,6 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
protected override bool CanReadType(System.Type type) { throw null; }
protected virtual System.Xml.Serialization.XmlSerializer CreateSerializer(System.Type type) { throw null; }
protected virtual System.Xml.XmlReader CreateXmlReader(System.IO.Stream readStream, System.Text.Encoding encoding) { throw null; }
+ protected virtual System.Xml.XmlReader CreateXmlReader(System.IO.Stream readStream, System.Text.Encoding encoding, System.Type type) { throw null; }
protected virtual System.Xml.Serialization.XmlSerializer GetCachedSerializer(System.Type type) { throw null; }
protected virtual System.Type GetSerializableType(System.Type declaredType) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute]
diff --git a/src/Mvc/Mvc.Formatters.Xml/src/XmlSerializerInputFormatter.cs b/src/Mvc/Mvc.Formatters.Xml/src/XmlSerializerInputFormatter.cs
index 4debb6fe69..da40141ded 100644
--- a/src/Mvc/Mvc.Formatters.Xml/src/XmlSerializerInputFormatter.cs
+++ b/src/Mvc/Mvc.Formatters.Xml/src/XmlSerializerInputFormatter.cs
@@ -119,8 +119,8 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
try
{
- using var xmlReader = CreateXmlReader(readStream, encoding);
- var type = GetSerializableType(context.ModelType);
+ var type = GetSerializableType(context.ModelType);
+ using var xmlReader = CreateXmlReader(readStream, encoding, type);
var serializer = GetCachedSerializer(type);
@@ -191,6 +191,18 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
return wrapperProvider?.WrappingType ?? declaredType;
}
+ ///
+ /// Called during deserialization to get the .
+ ///
+ /// The from which to read.
+ /// The used to read the stream.
+ /// The that is to be deserialized.
+ /// The used during deserialization.
+ protected virtual XmlReader CreateXmlReader(Stream readStream, Encoding encoding, Type type)
+ {
+ return CreateXmlReader(readStream, encoding);
+ }
+
///
/// Called during deserialization to get the .
///