diff --git a/Src/Directory.Build.props b/Src/Directory.Build.props
index a570e7e9..3df27f22 100644
--- a/Src/Directory.Build.props
+++ b/Src/Directory.Build.props
@@ -6,7 +6,7 @@
2.9.2
4.3.0
1.0.0-beta2-19367-01
- 3.3.0-beta1-final
+ 3.3.1-beta3-final
15.7.2
4.8.1
3.11.0
diff --git a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs
index bd45657e..7390503a 100644
--- a/Src/Newtonsoft.Json/Converters/BinaryConverter.cs
+++ b/Src/Newtonsoft.Json/Converters/BinaryConverter.cs
@@ -71,7 +71,7 @@ namespace Newtonsoft.Json.Converters
if (value.GetType().FullName == BinaryTypeName)
{
EnsureReflectionObject(value.GetType());
- Debug.Assert(_reflectionObject != null);
+ MiscellaneousUtils.Assert(_reflectionObject != null);
return (byte[])_reflectionObject.GetValue(value, BinaryToArrayName)!;
}
@@ -142,7 +142,7 @@ namespace Newtonsoft.Json.Converters
if (t.FullName == BinaryTypeName)
{
EnsureReflectionObject(t);
- Debug.Assert(_reflectionObject != null);
+ MiscellaneousUtils.Assert(_reflectionObject != null);
return _reflectionObject.Creator!(data);
}
diff --git a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
index f7a90fb8..4670dba4 100644
--- a/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
+++ b/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
@@ -60,7 +60,7 @@ namespace Newtonsoft.Json.Converters
}
EnsureReflectionObject(value.GetType());
- Debug.Assert(_reflectionObject != null);
+ MiscellaneousUtils.Assert(_reflectionObject != null);
DefaultContractResolver? resolver = serializer.ContractResolver as DefaultContractResolver;
@@ -117,7 +117,7 @@ namespace Newtonsoft.Json.Converters
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
EnsureReflectionObject(objectType);
- Debug.Assert(_reflectionObject != null);
+ MiscellaneousUtils.Assert(_reflectionObject != null);
object entityKeyMember = _reflectionObject.Creator!();
diff --git a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
index 49977b5e..d9c8ee23 100644
--- a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
+++ b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
@@ -57,7 +57,7 @@ namespace Newtonsoft.Json.Converters
public string? DateTimeFormat
{
get => _dateTimeFormat ?? string.Empty;
- set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
+ set => _dateTimeFormat = (StringUtils.IsNullOrEmpty(value)) ? null : value;
}
///
@@ -162,7 +162,7 @@ namespace Newtonsoft.Json.Converters
string? dateText = reader.Value?.ToString();
- if (string.IsNullOrEmpty(dateText) && nullable)
+ if (StringUtils.IsNullOrEmpty(dateText) && nullable)
{
return null;
}
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Converters
#if HAVE_DATE_TIME_OFFSET
if (t == typeof(DateTimeOffset))
{
- if (!string.IsNullOrEmpty(_dateTimeFormat))
+ if (!StringUtils.IsNullOrEmpty(_dateTimeFormat))
{
return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
}
@@ -181,7 +181,7 @@ namespace Newtonsoft.Json.Converters
}
#endif
- if (!string.IsNullOrEmpty(_dateTimeFormat))
+ if (!StringUtils.IsNullOrEmpty(_dateTimeFormat))
{
return DateTime.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
}
diff --git a/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs b/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
index 550c02d9..9ba6b632 100644
--- a/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
+++ b/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
@@ -230,7 +230,7 @@ namespace Newtonsoft.Json.Converters
{
string? enumText = reader.Value?.ToString();
- if (string.IsNullOrEmpty(enumText) && isNullable)
+ if (StringUtils.IsNullOrEmpty(enumText) && isNullable)
{
return null;
}
diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
index c3205ece..2abb677a 100644
--- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
+++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
@@ -882,9 +882,9 @@ namespace Newtonsoft.Json.Converters
private bool HasImplicitNamespaceAttribute(string namespaceUri)
{
- if (!string.IsNullOrEmpty(namespaceUri) && namespaceUri != ParentNode?.NamespaceUri)
+ if (!StringUtils.IsNullOrEmpty(namespaceUri) && namespaceUri != ParentNode?.NamespaceUri)
{
- if (string.IsNullOrEmpty(GetPrefixOfNamespace(namespaceUri)))
+ if (StringUtils.IsNullOrEmpty(GetPrefixOfNamespace(namespaceUri)))
{
bool namespaceDeclared = false;
@@ -892,7 +892,7 @@ namespace Newtonsoft.Json.Converters
{
foreach (XAttribute attribute in Element.Attributes())
{
- if (attribute.Name.LocalName == "xmlns" && string.IsNullOrEmpty(attribute.Name.NamespaceName) && attribute.Value == namespaceUri)
+ if (attribute.Name.LocalName == "xmlns" && StringUtils.IsNullOrEmpty(attribute.Name.NamespaceName) && attribute.Value == namespaceUri)
{
namespaceDeclared = true;
}
@@ -1072,7 +1072,7 @@ namespace Newtonsoft.Json.Converters
? null
: manager.LookupPrefix(node.NamespaceUri);
- if (!string.IsNullOrEmpty(prefix))
+ if (!StringUtils.IsNullOrEmpty(prefix))
{
return prefix + ":" + XmlConvert.DecodeName(node.LocalName);
}
@@ -1405,17 +1405,17 @@ namespace Newtonsoft.Json.Converters
writer.WritePropertyName(GetPropertyName(node, manager));
writer.WriteStartObject();
- if (!string.IsNullOrEmpty(declaration.Version))
+ if (!StringUtils.IsNullOrEmpty(declaration.Version))
{
writer.WritePropertyName("@version");
writer.WriteValue(declaration.Version);
}
- if (!string.IsNullOrEmpty(declaration.Encoding))
+ if (!StringUtils.IsNullOrEmpty(declaration.Encoding))
{
writer.WritePropertyName("@encoding");
writer.WriteValue(declaration.Encoding);
}
- if (!string.IsNullOrEmpty(declaration.Standalone))
+ if (!StringUtils.IsNullOrEmpty(declaration.Standalone))
{
writer.WritePropertyName("@standalone");
writer.WriteValue(declaration.Standalone);
@@ -1428,22 +1428,22 @@ namespace Newtonsoft.Json.Converters
writer.WritePropertyName(GetPropertyName(node, manager));
writer.WriteStartObject();
- if (!string.IsNullOrEmpty(documentType.Name))
+ if (!StringUtils.IsNullOrEmpty(documentType.Name))
{
writer.WritePropertyName("@name");
writer.WriteValue(documentType.Name);
}
- if (!string.IsNullOrEmpty(documentType.Public))
+ if (!StringUtils.IsNullOrEmpty(documentType.Public))
{
writer.WritePropertyName("@public");
writer.WriteValue(documentType.Public);
}
- if (!string.IsNullOrEmpty(documentType.System))
+ if (!StringUtils.IsNullOrEmpty(documentType.System))
{
writer.WritePropertyName("@system");
writer.WriteValue(documentType.System);
}
- if (!string.IsNullOrEmpty(documentType.InternalSubset))
+ if (!StringUtils.IsNullOrEmpty(documentType.InternalSubset))
{
writer.WritePropertyName("@internalSubset");
writer.WriteValue(documentType.InternalSubset);
@@ -1537,7 +1537,7 @@ namespace Newtonsoft.Json.Converters
throw JsonSerializationException.Create(reader, "Unexpected type when converting XML: " + objectType);
}
- if (!string.IsNullOrEmpty(DeserializeRootElementName))
+ if (!StringUtils.IsNullOrEmpty(DeserializeRootElementName))
{
ReadElement(reader, document, rootNode, DeserializeRootElementName, manager);
}
@@ -1586,7 +1586,7 @@ namespace Newtonsoft.Json.Converters
return;
default:
// processing instructions and the xml declaration start with ?
- if (!string.IsNullOrEmpty(propertyName) && propertyName[0] == '?')
+ if (!StringUtils.IsNullOrEmpty(propertyName) && propertyName[0] == '?')
{
CreateInstruction(reader, document, currentNode, propertyName);
return;
@@ -1616,7 +1616,7 @@ namespace Newtonsoft.Json.Converters
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager)
{
- if (string.IsNullOrEmpty(propertyName))
+ if (StringUtils.IsNullOrEmpty(propertyName))
{
throw JsonSerializationException.Create(reader, "XmlNodeConverter cannot convert JSON with an empty property name to XML.");
}
@@ -1685,7 +1685,7 @@ namespace Newtonsoft.Json.Converters
string encodedName = XmlConvert.EncodeName(nameValue.Key);
string? attributePrefix = MiscellaneousUtils.GetPrefix(nameValue.Key);
- IXmlNode attribute = (!string.IsNullOrEmpty(attributePrefix)) ? document.CreateAttribute(encodedName, manager.LookupNamespace(attributePrefix) ?? string.Empty, nameValue.Value) : document.CreateAttribute(encodedName, nameValue.Value);
+ IXmlNode attribute = (!StringUtils.IsNullOrEmpty(attributePrefix)) ? document.CreateAttribute(encodedName, manager.LookupNamespace(attributePrefix) ?? string.Empty, nameValue.Value) : document.CreateAttribute(encodedName, nameValue.Value);
element.SetAttributeNode(attribute);
}
@@ -1733,7 +1733,7 @@ namespace Newtonsoft.Json.Converters
string encodedName = XmlConvert.EncodeName(attributeName);
string? attributeValue = ConvertTokenToXmlValue(reader);
- IXmlNode attribute = (!string.IsNullOrEmpty(attributePrefix))
+ IXmlNode attribute = (!StringUtils.IsNullOrEmpty(attributePrefix))
? document.CreateAttribute(encodedName, manager.LookupNamespace(attributePrefix), attributeValue)
: document.CreateAttribute(encodedName, attributeValue);
@@ -1876,7 +1876,7 @@ namespace Newtonsoft.Json.Converters
case JsonToken.PropertyName:
string attributeName = reader.Value!.ToString();
- if (!string.IsNullOrEmpty(attributeName))
+ if (!StringUtils.IsNullOrEmpty(attributeName))
{
char firstChar = attributeName[0];
string? attributeValue;
@@ -2058,9 +2058,9 @@ namespace Newtonsoft.Json.Converters
private IXmlElement CreateElement(string elementName, IXmlDocument document, string? elementPrefix, XmlNamespaceManager manager)
{
string encodeName = EncodeSpecialCharacters ? XmlConvert.EncodeLocalName(elementName) : XmlConvert.EncodeName(elementName);
- string ns = string.IsNullOrEmpty(elementPrefix) ? manager.DefaultNamespace : manager.LookupNamespace(elementPrefix);
+ string ns = StringUtils.IsNullOrEmpty(elementPrefix) ? manager.DefaultNamespace : manager.LookupNamespace(elementPrefix);
- IXmlElement element = (!string.IsNullOrEmpty(ns)) ? document.CreateElement(encodeName, ns) : document.CreateElement(encodeName);
+ IXmlElement element = (!StringUtils.IsNullOrEmpty(ns)) ? document.CreateElement(encodeName, ns) : document.CreateElement(encodeName);
return element;
}
@@ -2092,7 +2092,7 @@ namespace Newtonsoft.Json.Converters
if (count == 1 && WriteArrayAttribute)
{
MiscellaneousUtils.GetQualifiedNameParts(propertyName, out string? elementPrefix, out string localName);
- string ns = string.IsNullOrEmpty(elementPrefix) ? manager.DefaultNamespace : manager.LookupNamespace(elementPrefix);
+ string ns = StringUtils.IsNullOrEmpty(elementPrefix) ? manager.DefaultNamespace : manager.LookupNamespace(elementPrefix);
foreach (IXmlNode childNode in currentNode.ChildNodes)
{
diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs
index ba19d3d3..736ee0df 100644
--- a/Src/Newtonsoft.Json/JsonReader.cs
+++ b/Src/Newtonsoft.Json/JsonReader.cs
@@ -445,7 +445,7 @@ namespace Newtonsoft.Json
internal int? ReadInt32String(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
@@ -656,7 +656,7 @@ namespace Newtonsoft.Json
internal double? ReadDoubleString(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
@@ -715,7 +715,7 @@ namespace Newtonsoft.Json
internal bool? ReadBooleanString(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
@@ -786,7 +786,7 @@ namespace Newtonsoft.Json
internal decimal? ReadDecimalString(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
@@ -840,7 +840,7 @@ namespace Newtonsoft.Json
internal DateTime? ReadDateTimeString(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
@@ -895,7 +895,7 @@ namespace Newtonsoft.Json
internal DateTimeOffset? ReadDateTimeOffsetString(string? s)
{
- if (string.IsNullOrEmpty(s))
+ if (StringUtils.IsNullOrEmpty(s))
{
SetToken(JsonToken.Null, null, false);
return null;
diff --git a/Src/Newtonsoft.Json/JsonTextReader.Async.cs b/Src/Newtonsoft.Json/JsonTextReader.Async.cs
index 443c3055..7963f5b9 100644
--- a/Src/Newtonsoft.Json/JsonTextReader.Async.cs
+++ b/Src/Newtonsoft.Json/JsonTextReader.Async.cs
@@ -111,7 +111,7 @@ namespace Newtonsoft.Json
private async Task ParsePostValueAsync(bool ignoreComments, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
while (true)
{
@@ -196,7 +196,7 @@ namespace Newtonsoft.Json
private async Task ReadFromFinishedAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
if (await EnsureCharsAsync(0, false, cancellationToken).ConfigureAwait(false))
{
@@ -227,7 +227,7 @@ namespace Newtonsoft.Json
private async Task ReadDataAsync(bool append, int charsRequired, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
if (_isEndOfFile)
{
@@ -251,7 +251,7 @@ namespace Newtonsoft.Json
private async Task ParseValueAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
while (true)
{
@@ -382,7 +382,7 @@ namespace Newtonsoft.Json
private async Task ReadStringIntoBufferAsync(char quote, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
int charPos = _charPos;
int initialPosition = _charPos;
@@ -600,7 +600,7 @@ namespace Newtonsoft.Json
private async Task ParseObjectAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
while (true)
{
@@ -659,7 +659,7 @@ namespace Newtonsoft.Json
private async Task ParseCommentAsync(bool setToken, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
// should have already parsed / character before reaching this method
_charPos++;
@@ -757,7 +757,7 @@ namespace Newtonsoft.Json
private async Task EatWhitespaceAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
while (true)
{
@@ -815,7 +815,7 @@ namespace Newtonsoft.Json
private async Task MatchValueWithTrailingSeparatorAsync(string value, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
// will match value and then move to the next character, checking that it is a separator character
if (!await MatchValueAsync(value, cancellationToken).ConfigureAwait(false))
@@ -860,7 +860,7 @@ namespace Newtonsoft.Json
private async Task ParseConstructorAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
if (await MatchValueWithTrailingSeparatorAsync("new", cancellationToken).ConfigureAwait(false))
{
@@ -960,7 +960,7 @@ namespace Newtonsoft.Json
private async Task ParseNumberAsync(ReadType readType, CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
ShiftBufferIfNeeded();
@@ -979,7 +979,7 @@ namespace Newtonsoft.Json
private async Task ParsePropertyAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
char firstChar = _chars[_charPos];
char quoteChar;
@@ -1033,7 +1033,7 @@ namespace Newtonsoft.Json
private async Task ReadNumberIntoBufferAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
int charPos = _charPos;
@@ -1069,7 +1069,7 @@ namespace Newtonsoft.Json
private async Task ParseUnquotedPropertyAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
int initialPosition = _charPos;
@@ -1120,7 +1120,7 @@ namespace Newtonsoft.Json
private async Task HandleNullAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
if (await EnsureCharsAsync(1, true, cancellationToken).ConfigureAwait(false))
{
@@ -1140,7 +1140,7 @@ namespace Newtonsoft.Json
private async Task ReadFinishedAsync(CancellationToken cancellationToken)
{
- Debug.Assert(_chars != null);
+ MiscellaneousUtils.Assert(_chars != null);
if (await EnsureCharsAsync(0, false, cancellationToken).ConfigureAwait(false))
{
@@ -1167,7 +1167,7 @@ namespace Newtonsoft.Json
private async Task