Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR feedback
  • Loading branch information
eerhardt committed Sep 22, 2021
commit f1b0cac71f39aa139e69cda3f7dd7fffc32153b7
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,17 @@ public virtual bool CanDeserialize(XmlReader xmlReader)
TypeDesc typeDesc = (TypeDesc)TypeScope.PrimtiveTypes[_primitiveType]!;
return xmlReader.IsStartElement(typeDesc.DataType!.Name!, string.Empty);
}
else if (_tempAssembly != null)
else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
{
return _tempAssembly.CanRead(_mapping, xmlReader);
// If we should use reflection, we will try to do reflection-based deserialization, without fallback.
// Don't check xmlReader.IsStartElement to avoid having to duplicate SOAP deserialization logic here.
// It is better to return an incorrect 'true', which will throw during Deserialize than to return an
// incorrect 'false', and the caller won't even try to Deserialize when it would succeed.
return true;
}
else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
else if (_tempAssembly != null)
{
return ReflectionMethodEnabled;
return _tempAssembly.CanRead(_mapping, xmlReader);
}
else
{
Expand Down