-
Notifications
You must be signed in to change notification settings - Fork 161
Description
(Updated)
This implementation mishandles surrogate pairs. Control characters other than tab, carriage return and line feed cannot be represented in XML and should throw, IIRC. (See nunit/nunit3-vs-adapter#484.)
| private static string XmlEscape(string text) | |
| { | |
| return text | |
| .Replace("&", "&") | |
| .Replace("\"", """) | |
| .Replace("<", "<") | |
| .Replace(">", ">") | |
| .Replace("'", "'"); | |
| } |
GetFilter() should be using XmlWriter.Create to a StringWriter. This will not only get us out of the responsibility of implementing the XML spec, it will probably also result in some significant performance gains. (Judging by the chained string.Replace calls.)
(Test names containing control characters cannot be represented in XML without first encoding using base64 or something custom. This will need to be dealt separately with in the framework.)
@nunit/engine-team Does this seem right to you? Can we let @MatthewBeardmore get started on this if he is interested?