This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Fix a bug in xsd validation during deserialization#37596
Merged
jiayi11 merged 2 commits intodotnet:masterfrom May 17, 2019
Merged
Fix a bug in xsd validation during deserialization#37596jiayi11 merged 2 commits intodotnet:masterfrom
jiayi11 merged 2 commits intodotnet:masterfrom
Conversation
Contributor
|
@yujayee Add a corresponding regression test? |
Contributor
|
Unrelated to this specific bug, but can't you just immediately return typedValue if you know it's a string (hereby bypassing the value converter)? object typedValue = InternalReadElementContentAsObject(out XmlSchemaType xmlType);
if (typedValue != null)
{
var stringValue = typedValue as string;
if (stringValue != null)
{
return stringValue;
}
if (xmlType != null)
{
try
{
xmlType.ValueConverter.ToString(typedValue);
}
catch (InvalidCastException)
{
throw new XmlException();
}
catch (FormatException)
{
throw new XmlException();
}
catch (OverflowException)
{
throw new XmlException();
}
}
}
return string.Empty;Based on some limited testing, this would make |
Member
Author
|
@drieseng Thanks for reviewing this pr😄 I just added a test for the code change. Xsd validating during deserialization is probably not on a hot code pass. So I wanted to make the code change minimal to make it more clear. |
mconnew
approved these changes
May 16, 2019
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
* Fix a bug in xsd validation during deserialization * Add a test Commit migrated from dotnet/corefx@4435d78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36819