public static void XmlWriterChecksUpperBoundOfLowerSurrogate_newBehavior()
{
// Turn the switch off to get the new behavior in case the platform has it on by default
AppContext.SetSwitch(@"Switch.System.Xml.DontThrowOnInvalidSurrogatePairs", false);
using (XmlWriter writer = CreateUtf8Writer())
{
writer.WriteStartDocument();
writer.WriteStartElement("test");
char[] invalidSurrogatePair = new char[] { (char)(SurHighStart + 5), (char)(SurLowEnd + 1) };
Assert.Throws<ArgumentException>(() =>
{
writer.WriteRaw(invalidSurrogatePair, 0, invalidSurrogatePair.Length);
});
}
}