From e60e59bd4ffc32bf58d4e31fa813bfc88dcda1f9 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 11 Aug 2022 22:40:27 +0200 Subject: [PATCH] fix comment, replace assert with ArgumentNullException.ThrowIfNull --- .../src/System/Xml/Dom/XmlProcessingInstruction.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlProcessingInstruction.cs b/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlProcessingInstruction.cs index c66148d813c05..3e1ce5ccb832f 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlProcessingInstruction.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlProcessingInstruction.cs @@ -16,9 +16,9 @@ public class XmlProcessingInstruction : XmlLinkedNode protected internal XmlProcessingInstruction(string target, string? data, XmlDocument doc) : base(doc) { - Debug.Assert(target != null, "All callsites should have already checked for null"); + ArgumentNullException.ThrowIfNull(target); - if (string.IsNullOrEmpty(target)) + if (target.Length == 0) { throw new ArgumentException(SR.Xml_EmptyName); } @@ -38,7 +38,7 @@ protected internal XmlProcessingInstruction(string target, string? data, XmlDocu public override string Value { get => _data; - set { Data = value; } // use Data instead of data so that event will be fired + set { Data = value; } // use Data instead of data so that event will be fired and null will be normalized to empty string } // Gets the target of the processing instruction. @@ -75,7 +75,7 @@ public string Data public override string InnerText { get => _data; - set { Data = value; } // use Data instead of data so that change event will be fired + set { Data = value; } // use Data instead of data so that event will be fired and null will be normalized to empty string } ///