even just in this simple case safeXml is "";
string safeXml = SyndicationEncodingUtility.RemoveInvalidXmlHexadecimalCharacters("123");
I discovered it when i tried to load feed from string and this method returned just cryptic string of slashes.
I've added test case
[TestMethod]
public void RemoveInvalidXmlHexadecimalCharactersTest()
{
string safeXml = SyndicationEncodingUtility.RemoveInvalidXmlHexadecimalCharacters("123");
Assert.AreEqual("123", safeXml); // safeXml is empty
}
I've fixed it by changing regular expression from [\x01-\x08\x0B-\x0C\x0E-\x1F\xD800-\xDFFF\xFFFE-\xFFFF] to [^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD].
I left .net 2.0 version untouched in case I'll discover nay error in near future. If all will work fine I'll change 2.0 version too.