chore: Newtonsoft.Json.AOT 12.0.201

oneRain 2021-03-31 11:49:13 +08:00
parent 3a0b247817
commit b59b3028c6
39 changed files with 214 additions and 333 deletions

View File

@ -587,7 +587,7 @@ namespace LC.Newtonsoft.Json
/// A JSON string representation of the object. /// A JSON string representation of the object.
/// </returns> /// </returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static string SerializeObject(object? value, JsonSerializerSettings? settings) public static string SerializeObject(object? value, JsonSerializerSettings settings)
{ {
return SerializeObject(value, null, settings); return SerializeObject(value, null, settings);
} }
@ -715,7 +715,7 @@ namespace LC.Newtonsoft.Json
/// <param name="value">The JSON to deserialize.</param> /// <param name="value">The JSON to deserialize.</param>
/// <returns>The deserialized object from the JSON string.</returns> /// <returns>The deserialized object from the JSON string.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static T? DeserializeObject<T>(string value) public static T DeserializeObject<T>(string value)
{ {
return DeserializeObject<T>(value, (JsonSerializerSettings?)null); return DeserializeObject<T>(value, (JsonSerializerSettings?)null);
} }
@ -732,7 +732,7 @@ namespace LC.Newtonsoft.Json
/// <param name="anonymousTypeObject">The anonymous type object.</param> /// <param name="anonymousTypeObject">The anonymous type object.</param>
/// <returns>The deserialized anonymous type from the JSON string.</returns> /// <returns>The deserialized anonymous type from the JSON string.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject) public static T DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
{ {
return DeserializeObject<T>(value); return DeserializeObject<T>(value);
} }
@ -753,7 +753,7 @@ namespace LC.Newtonsoft.Json
/// </param> /// </param>
/// <returns>The deserialized anonymous type from the JSON string.</returns> /// <returns>The deserialized anonymous type from the JSON string.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings) public static T DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
{ {
return DeserializeObject<T>(value, settings); return DeserializeObject<T>(value, settings);
} }
@ -766,9 +766,12 @@ namespace LC.Newtonsoft.Json
/// <param name="converters">Converters to use while deserializing.</param> /// <param name="converters">Converters to use while deserializing.</param>
/// <returns>The deserialized object from the JSON string.</returns> /// <returns>The deserialized object from the JSON string.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static T? DeserializeObject<T>(string value, params JsonConverter[] converters) [return: MaybeNull]
public static T DeserializeObject<T>(string value, params JsonConverter[] converters)
{ {
return (T?)DeserializeObject(value, typeof(T), converters); #pragma warning disable CS8601 // Possible null reference assignment.
return (T)DeserializeObject(value, typeof(T), converters);
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>
@ -782,9 +785,12 @@ namespace LC.Newtonsoft.Json
/// </param> /// </param>
/// <returns>The deserialized object from the JSON string.</returns> /// <returns>The deserialized object from the JSON string.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings) [return: MaybeNull]
public static T DeserializeObject<T>(string value, JsonSerializerSettings? settings)
{ {
return (T?)DeserializeObject(value, typeof(T), settings); #pragma warning disable CS8601 // Possible null reference assignment.
return (T)DeserializeObject(value, typeof(T), settings);
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>

View File

@ -94,7 +94,9 @@ namespace LC.Newtonsoft.Json
{ {
throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T))); throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
} }
WriteJson(writer, (T?)value, serializer); #pragma warning disable CS8601 // Possible null reference assignment.
WriteJson(writer, (T)value, serializer);
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>
@ -103,7 +105,7 @@ namespace LC.Newtonsoft.Json
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param> /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param> /// <param name="serializer">The calling serializer.</param>
public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer); public abstract void WriteJson(JsonWriter writer, [AllowNull]T value, JsonSerializer serializer);
/// <summary> /// <summary>
/// Reads the JSON representation of the object. /// Reads the JSON representation of the object.
@ -120,7 +122,9 @@ namespace LC.Newtonsoft.Json
{ {
throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T))); throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
} }
return ReadJson(reader, objectType, existingIsNull ? default : (T?)existingValue, !existingIsNull, serializer); #pragma warning disable CS8601 // Possible null reference assignment.
return ReadJson(reader, objectType, existingIsNull ? default : (T)existingValue, !existingIsNull, serializer);
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>
@ -132,7 +136,7 @@ namespace LC.Newtonsoft.Json
/// <param name="hasExistingValue">The existing value has a value.</param> /// <param name="hasExistingValue">The existing value has a value.</param>
/// <param name="serializer">The calling serializer.</param> /// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns> /// <returns>The object value.</returns>
public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer); public abstract T ReadJson(JsonReader reader, Type objectType, [AllowNull]T existingValue, bool hasExistingValue, JsonSerializer serializer);
/// <summary> /// <summary>
/// Determines whether this instance can convert the specified object type. /// Determines whether this instance can convert the specified object type.

View File

@ -227,8 +227,6 @@ namespace LC.Newtonsoft.Json
/// <summary> /// <summary>
/// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>. /// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>.
/// A null value means there is no maximum.
/// The default value is <c>128</c>.
/// </summary> /// </summary>
public int? MaxDepth public int? MaxDepth
{ {
@ -329,7 +327,6 @@ namespace LC.Newtonsoft.Json
_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
_dateParseHandling = DateParseHandling.DateTime; _dateParseHandling = DateParseHandling.DateTime;
_floatParseHandling = FloatParseHandling.Double; _floatParseHandling = FloatParseHandling.Double;
_maxDepth = 64;
CloseInput = true; CloseInput = true;
} }

View File

@ -514,7 +514,7 @@ namespace LC.Newtonsoft.Json
/// <summary> /// <summary>
/// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>. /// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>.
/// A null value means there is no maximum. /// A null value means there is no maximum.
/// The default value is <c>128</c>. /// The default value is <c>null</c>.
/// </summary> /// </summary>
public virtual int? MaxDepth public virtual int? MaxDepth
{ {
@ -865,9 +865,12 @@ namespace LC.Newtonsoft.Json
/// <typeparam name="T">The type of the object to deserialize.</typeparam> /// <typeparam name="T">The type of the object to deserialize.</typeparam>
/// <returns>The instance of <typeparamref name="T"/> being deserialized.</returns> /// <returns>The instance of <typeparamref name="T"/> being deserialized.</returns>
[DebuggerStepThrough] [DebuggerStepThrough]
public T? Deserialize<T>(JsonReader reader) [return: MaybeNull]
public T Deserialize<T>(JsonReader reader)
{ {
return (T?)Deserialize(reader, typeof(T)); #pragma warning disable CS8601 // Possible null reference assignment.
return (T)Deserialize(reader, typeof(T));
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>

View File

@ -61,7 +61,6 @@ namespace LC.Newtonsoft.Json
internal static readonly CultureInfo DefaultCulture; internal static readonly CultureInfo DefaultCulture;
internal const bool DefaultCheckAdditionalContent = false; internal const bool DefaultCheckAdditionalContent = false;
internal const string DefaultDateFormatString = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; internal const string DefaultDateFormatString = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
internal const int DefaultMaxDepth = 64;
internal Formatting? _formatting; internal Formatting? _formatting;
internal DateFormatHandling? _dateFormatHandling; internal DateFormatHandling? _dateFormatHandling;
@ -326,11 +325,11 @@ namespace LC.Newtonsoft.Json
/// <summary> /// <summary>
/// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>. /// Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="JsonReaderException"/>.
/// A null value means there is no maximum. /// A null value means there is no maximum.
/// The default value is <c>128</c>. /// The default value is <c>null</c>.
/// </summary> /// </summary>
public int? MaxDepth public int? MaxDepth
{ {
get => _maxDepthSet ? _maxDepth : DefaultMaxDepth; get => _maxDepth;
set set
{ {
if (value <= 0) if (value <= 0)

View File

@ -62,7 +62,7 @@ namespace LC.Newtonsoft.Json
// array that gives a new state based on the current state an the token being written // array that gives a new state based on the current state an the token being written
private static readonly State[][] StateArray; private static readonly State[][] StateArray;
internal static readonly State[][] StateArrayTemplate = new[] internal static readonly State[][] StateArrayTempate = new[]
{ {
// Start PropertyName ObjectStart Object ArrayStart Array ConstructorStart Constructor Closed Error // Start PropertyName ObjectStart Object ArrayStart Array ConstructorStart Constructor Closed Error
// //
@ -78,9 +78,9 @@ namespace LC.Newtonsoft.Json
internal static State[][] BuildStateArray() internal static State[][] BuildStateArray()
{ {
List<State[]> allStates = StateArrayTemplate.ToList(); List<State[]> allStates = StateArrayTempate.ToList();
State[] errorStates = StateArrayTemplate[0]; State[] errorStates = StateArrayTempate[0];
State[] valueStates = StateArrayTemplate[7]; State[] valueStates = StateArrayTempate[7];
EnumInfo enumValuesAndNames = EnumUtils.GetEnumValuesAndNames(typeof(JsonToken)); EnumInfo enumValuesAndNames = EnumUtils.GetEnumValuesAndNames(typeof(JsonToken));
@ -579,9 +579,8 @@ namespace LC.Newtonsoft.Json
} }
break; break;
case JsonToken.String: case JsonToken.String:
// Allow for a null string. This matches JTokenReader behavior which can read ValidationUtils.ArgumentNotNull(value, nameof(value));
// a JsonToken.String with a null value. WriteValue(value.ToString());
WriteValue(value?.ToString());
break; break;
case JsonToken.Boolean: case JsonToken.Boolean:
ValidationUtils.ArgumentNotNull(value, nameof(value)); ValidationUtils.ArgumentNotNull(value, nameof(value));

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<LibraryFrameworks>netstandard2.0</LibraryFrameworks>
<UnityBuild>AOT</UnityBuild> <UnityBuild>AOT</UnityBuild>
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0</TargetFrameworks> <TargetFrameworks Condition="'$(LibraryFrameworks)'==''">netstandard2.0;net45;portable-net45+win8+wpa81+wp8</TargetFrameworks>
<TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks> <TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks>
<LangVersion>9.0</LangVersion> <LangVersion>8.0</LangVersion>
<!-- version numbers will be updated by build --> <!-- version numbers will be updated by build -->
<AssemblyVersion>11.0.0.0</AssemblyVersion> <AssemblyVersion>11.0.0.0</AssemblyVersion>
<FileVersion>11.0.1</FileVersion> <FileVersion>11.0.1</FileVersion>
@ -38,18 +39,17 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="**\*.orig" /> <None Remove="**\*.orig" />
<EmbeddedResource Include="Resources\link.xml">
<LogicalName>Newtonsoft.Json.xml</LogicalName>
</EmbeddedResource>
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" /> <None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
<None Include="$(PackageIconFullPath)" Pack="true" PackagePath="\" /> <None Include="$(PackageIconFullPath)" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="$(MicrosoftCodeAnalysisNetAnalyzersPackageVersion)" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="$(MicrosoftCodeAnalysisFxCopAnalyzersPackageVersion)" PrivateAssets="All" />
<!-- Compiler to support nullable in non-preview VS2019 -->
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetPackageVersion)" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(UnityBuild)'=='Tests' OR ('$(UnityBuild)'=='' AND '$(TargetFramework)'=='net46')"> <PropertyGroup Condition="'$(UnityBuild)'=='Tests' OR ('$(UnityBuild)'=='' AND '$(TargetFramework)'=='net45')">
<!-- Only used in Unity Tests & Newtonsoft.Json.Tests --> <!-- Only used in Unity Tests & Newtonsoft.Json.Tests -->
<TargetFramework>net46</TargetFramework> <TargetFramework>net45</TargetFramework>
<AssemblyTitle>Json.NET for Unity tests (NOT FOR PRODUCTION)</AssemblyTitle> <AssemblyTitle>Json.NET for Unity tests (NOT FOR PRODUCTION)</AssemblyTitle>
<DefineConstants>DEBUG;NET45;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants> <DefineConstants>DEBUG;NET45;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CAS;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_EMIT;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<OutputPath>bin\$(Configuration)\unity-tests</OutputPath> <OutputPath>bin\$(Configuration)\unity-tests</OutputPath>
@ -75,7 +75,19 @@
<DefineConstants>NETSTANDARD2_0;UNITY_LTS;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants> <DefineConstants>NETSTANDARD2_0;UNITY_LTS;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants>
<OutputPath>bin\$(Configuration)\unity-aot</OutputPath> <OutputPath>bin\$(Configuration)\unity-aot</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(UnityBuild)'=='Portable' OR '$(TargetFramework)'=='portable-net45+win8+wpa81+wp8'">
<!-- Unity portable (WP8, UWP, ...) build -->
<TargetFramework>portable-net45+win8+wpa81+wp8</TargetFramework>
<AssemblyTitle>Json.NET for Unity portable (wp8)</AssemblyTitle>
<DefineConstants>PORTABLE;HAVE_ASYNC;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;$(AdditionalConstants)</DefineConstants>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<NugetTargetMoniker>.NETPortable,Version=v0.0,Profile=Profile259</NugetTargetMoniker>
<LanguageTargets>$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets</LanguageTargets>
<OutputPath>bin\$(Configuration)\unity-portable-net45</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>NETSTANDARD2_0;UNITY_LTS;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;$(AdditionalConstants)</DefineConstants> <DefineConstants>HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_CONCURRENT_DICTIONARY;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;;DEBUG;NETSTANDARD;NETSTANDARD2_0;</DefineConstants>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -115,7 +115,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the values of every token in the source collection with the given key.</returns> /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the values of every token in the source collection with the given key.</returns>
public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source, object? key) public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source, object? key)
{ {
return Values<JToken, JToken>(source, key)!.AsJEnumerable(); return Values<JToken, JToken>(source, key).AsJEnumerable();
} }
/// <summary> /// <summary>
@ -135,7 +135,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <param name="source">An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the source collection.</param> /// <param name="source">An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the source collection.</param>
/// <param name="key">The token key.</param> /// <param name="key">The token key.</param>
/// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection with the given key.</returns> /// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection with the given key.</returns>
public static IEnumerable<U?> Values<U>(this IEnumerable<JToken> source, object key) public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source, object key)
{ {
return Values<JToken, U>(source, key); return Values<JToken, U>(source, key);
} }
@ -146,7 +146,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="U">The type to convert the values to.</typeparam> /// <typeparam name="U">The type to convert the values to.</typeparam>
/// <param name="source">An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the source collection.</param> /// <param name="source">An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the source collection.</param>
/// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection.</returns> /// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection.</returns>
public static IEnumerable<U?> Values<U>(this IEnumerable<JToken> source) public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source)
{ {
return Values<JToken, U>(source, null); return Values<JToken, U>(source, null);
} }
@ -157,7 +157,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="U">The type to convert the value to.</typeparam> /// <typeparam name="U">The type to convert the value to.</typeparam>
/// <param name="value">A <see cref="JToken"/> cast as a <see cref="IEnumerable{T}"/> of <see cref="JToken"/>.</param> /// <param name="value">A <see cref="JToken"/> cast as a <see cref="IEnumerable{T}"/> of <see cref="JToken"/>.</param>
/// <returns>A converted value.</returns> /// <returns>A converted value.</returns>
public static U? Value<U>(this IEnumerable<JToken> value) public static U Value<U>(this IEnumerable<JToken> value)
{ {
return value.Value<JToken, U>(); return value.Value<JToken, U>();
} }
@ -169,7 +169,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="U">The type to convert the value to.</typeparam> /// <typeparam name="U">The type to convert the value to.</typeparam>
/// <param name="value">A <see cref="JToken"/> cast as a <see cref="IEnumerable{T}"/> of <see cref="JToken"/>.</param> /// <param name="value">A <see cref="JToken"/> cast as a <see cref="IEnumerable{T}"/> of <see cref="JToken"/>.</param>
/// <returns>A converted value.</returns> /// <returns>A converted value.</returns>
public static U? Value<T, U>(this IEnumerable<T> value) where T : JToken public static U Value<T, U>(this IEnumerable<T> value) where T : JToken
{ {
ValidationUtils.ArgumentNotNull(value, nameof(value)); ValidationUtils.ArgumentNotNull(value, nameof(value));
@ -181,7 +181,7 @@ namespace LC.Newtonsoft.Json.Linq
return token.Convert<JToken, U>(); return token.Convert<JToken, U>();
} }
internal static IEnumerable<U?> Values<T, U>(this IEnumerable<T> source, object? key) where T : JToken internal static IEnumerable<U> Values<T, U>(this IEnumerable<T> source, object? key) where T : JToken
{ {
ValidationUtils.ArgumentNotNull(source, nameof(source)); ValidationUtils.ArgumentNotNull(source, nameof(source));
@ -226,7 +226,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the values of every token in the source collection.</returns> /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the values of every token in the source collection.</returns>
public static IJEnumerable<JToken> Children<T>(this IEnumerable<T> source) where T : JToken public static IJEnumerable<JToken> Children<T>(this IEnumerable<T> source) where T : JToken
{ {
return Children<T, JToken>(source)!.AsJEnumerable(); return Children<T, JToken>(source).AsJEnumerable();
} }
/// <summary> /// <summary>
@ -236,14 +236,14 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="U">The type to convert the values to.</typeparam> /// <typeparam name="U">The type to convert the values to.</typeparam>
/// <typeparam name="T">The source collection type.</typeparam> /// <typeparam name="T">The source collection type.</typeparam>
/// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection.</returns> /// <returns>An <see cref="IEnumerable{T}"/> that contains the converted values of every token in the source collection.</returns>
public static IEnumerable<U?> Children<T, U>(this IEnumerable<T> source) where T : JToken public static IEnumerable<U> Children<T, U>(this IEnumerable<T> source) where T : JToken
{ {
ValidationUtils.ArgumentNotNull(source, nameof(source)); ValidationUtils.ArgumentNotNull(source, nameof(source));
return source.SelectMany(c => c.Children()).Convert<JToken, U>(); return source.SelectMany(c => c.Children()).Convert<JToken, U>();
} }
internal static IEnumerable<U?> Convert<T, U>(this IEnumerable<T> source) where T : JToken internal static IEnumerable<U> Convert<T, U>(this IEnumerable<T> source) where T : JToken
{ {
ValidationUtils.ArgumentNotNull(source, nameof(source)); ValidationUtils.ArgumentNotNull(source, nameof(source));
@ -253,7 +253,8 @@ namespace LC.Newtonsoft.Json.Linq
} }
} }
internal static U? Convert<T, U>(this T token) where T : JToken? [return: MaybeNull]
internal static U Convert<T, U>(this T token) where T : JToken?
{ {
if (token == null) if (token == null)
{ {

View File

@ -114,11 +114,9 @@ namespace LC.Newtonsoft.Json.Linq
int i = 0; int i = 0;
foreach (JToken child in other) foreach (JToken child in other)
{ {
TryAddInternal(i, child, false); AddInternal(i, child, false);
i++; i++;
} }
CopyAnnotations(this, other);
} }
internal void CheckReentrancy() internal void CheckReentrancy()
@ -275,7 +273,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns> /// <returns>
/// A <see cref="IEnumerable{T}"/> containing the child values of this <see cref="JToken"/>, in document order. /// A <see cref="IEnumerable{T}"/> containing the child values of this <see cref="JToken"/>, in document order.
/// </returns> /// </returns>
public override IEnumerable<T?> Values<T>() where T : default public override IEnumerable<T> Values<T>()
{ {
return ChildrenTokens.Convert<JToken, T>(); return ChildrenTokens.Convert<JToken, T>();
} }
@ -318,7 +316,7 @@ namespace LC.Newtonsoft.Json.Linq
} }
} }
internal bool IsMultiContent([NotNullWhen(true)]object? content) internal bool IsMultiContent([NotNull]object? content)
{ {
return (content is IEnumerable && !(content is string) && !(content is JToken) && !(content is byte[])); return (content is IEnumerable && !(content is string) && !(content is JToken) && !(content is byte[]));
} }
@ -349,7 +347,7 @@ namespace LC.Newtonsoft.Json.Linq
internal abstract int IndexOfItem(JToken? item); internal abstract int IndexOfItem(JToken? item);
internal virtual bool InsertItem(int index, JToken? item, bool skipParentCheck) internal virtual void InsertItem(int index, JToken? item, bool skipParentCheck)
{ {
IList<JToken> children = ChildrenTokens; IList<JToken> children = ChildrenTokens;
@ -396,8 +394,6 @@ namespace LC.Newtonsoft.Json.Linq
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index)); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
} }
#endif #endif
return true;
} }
internal virtual void RemoveItemAt(int index) internal virtual void RemoveItemAt(int index)
@ -635,17 +631,12 @@ namespace LC.Newtonsoft.Json.Linq
/// <param name="content">The content to be added.</param> /// <param name="content">The content to be added.</param>
public virtual void Add(object? content) public virtual void Add(object? content)
{ {
TryAddInternal(ChildrenTokens.Count, content, false); AddInternal(ChildrenTokens.Count, content, false);
}
internal bool TryAdd(object? content)
{
return TryAddInternal(ChildrenTokens.Count, content, false);
} }
internal void AddAndSkipParentCheck(JToken token) internal void AddAndSkipParentCheck(JToken token)
{ {
TryAddInternal(ChildrenTokens.Count, token, true); AddInternal(ChildrenTokens.Count, token, true);
} }
/// <summary> /// <summary>
@ -654,10 +645,10 @@ namespace LC.Newtonsoft.Json.Linq
/// <param name="content">The content to be added.</param> /// <param name="content">The content to be added.</param>
public void AddFirst(object? content) public void AddFirst(object? content)
{ {
TryAddInternal(0, content, false); AddInternal(0, content, false);
} }
internal bool TryAddInternal(int index, object? content, bool skipParentCheck) internal void AddInternal(int index, object? content, bool skipParentCheck)
{ {
if (IsMultiContent(content)) if (IsMultiContent(content))
{ {
@ -666,17 +657,15 @@ namespace LC.Newtonsoft.Json.Linq
int multiIndex = index; int multiIndex = index;
foreach (object c in enumerable) foreach (object c in enumerable)
{ {
TryAddInternal(multiIndex, c, skipParentCheck); AddInternal(multiIndex, c, skipParentCheck);
multiIndex++; multiIndex++;
} }
return true;
} }
else else
{ {
JToken item = CreateFromContent(content); JToken item = CreateFromContent(content);
return InsertItem(index, item, skipParentCheck); InsertItem(index, item, skipParentCheck);
} }
} }

View File

@ -88,7 +88,7 @@ namespace LC.Newtonsoft.Json.Linq
return JEnumerable<JToken>.Empty; return JEnumerable<JToken>.Empty;
} }
return new JEnumerable<JToken>(_enumerable.Values<T, JToken>(key)!); return new JEnumerable<JToken>(_enumerable.Values<T, JToken>(key));
} }
} }

View File

@ -135,15 +135,15 @@ namespace LC.Newtonsoft.Json.Linq
return _properties.IndexOfReference(item); return _properties.IndexOfReference(item);
} }
internal override bool InsertItem(int index, JToken? item, bool skipParentCheck) internal override void InsertItem(int index, JToken? item, bool skipParentCheck)
{ {
// don't add comments to JObject, no name to reference comment by // don't add comments to JObject, no name to reference comment by
if (item != null && item.Type == JTokenType.Comment) if (item != null && item.Type == JTokenType.Comment)
{ {
return false; return;
} }
return base.InsertItem(index, item, skipParentCheck); base.InsertItem(index, item, skipParentCheck);
} }
internal override void ValidateToken(JToken o, JToken? existing) internal override void ValidateToken(JToken o, JToken? existing)

View File

@ -241,12 +241,12 @@ namespace LC.Newtonsoft.Json.Linq
return _content.IndexOf(item); return _content.IndexOf(item);
} }
internal override bool InsertItem(int index, JToken? item, bool skipParentCheck) internal override void InsertItem(int index, JToken? item, bool skipParentCheck)
{ {
// don't add comments to JProperty // don't add comments to JProperty
if (item != null && item.Type == JTokenType.Comment) if (item != null && item.Type == JTokenType.Comment)
{ {
return false; return;
} }
if (Value != null) if (Value != null)
@ -254,7 +254,7 @@ namespace LC.Newtonsoft.Json.Linq
throw new JsonException("{0} cannot have multiple values.".FormatWith(CultureInfo.InvariantCulture, typeof(JProperty))); throw new JsonException("{0} cannot have multiple values.".FormatWith(CultureInfo.InvariantCulture, typeof(JProperty)));
} }
return base.InsertItem(0, item, false); base.InsertItem(0, item, false);
} }
internal override bool ContainsItem(JToken? item) internal override bool ContainsItem(JToken? item)

View File

@ -240,7 +240,7 @@ namespace LC.Newtonsoft.Json.Linq
} }
int index = _parent.IndexOfItem(this); int index = _parent.IndexOfItem(this);
_parent.TryAddInternal(index + 1, content, false); _parent.AddInternal(index + 1, content, false);
} }
/// <summary> /// <summary>
@ -255,7 +255,7 @@ namespace LC.Newtonsoft.Json.Linq
} }
int index = _parent.IndexOfItem(this); int index = _parent.IndexOfItem(this);
_parent.TryAddInternal(index, content, false); _parent.AddInternal(index, content, false);
} }
/// <summary> /// <summary>
@ -334,7 +334,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="T">The type to convert the token to.</typeparam> /// <typeparam name="T">The type to convert the token to.</typeparam>
/// <param name="key">The token key.</param> /// <param name="key">The token key.</param>
/// <returns>The converted token value.</returns> /// <returns>The converted token value.</returns>
public virtual T? Value<T>(object key) public virtual T Value<T>(object key)
{ {
JToken? token = this[key]; JToken? token = this[key];
@ -378,7 +378,7 @@ namespace LC.Newtonsoft.Json.Linq
/// </summary> /// </summary>
/// <typeparam name="T">The type to convert the values to.</typeparam> /// <typeparam name="T">The type to convert the values to.</typeparam>
/// <returns>A <see cref="IEnumerable{T}"/> containing the child values of this <see cref="JToken"/>, in document order.</returns> /// <returns>A <see cref="IEnumerable{T}"/> containing the child values of this <see cref="JToken"/>, in document order.</returns>
public virtual IEnumerable<T?> Values<T>() public virtual IEnumerable<T> Values<T>()
{ {
throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType()));
} }
@ -485,7 +485,7 @@ namespace LC.Newtonsoft.Json.Linq
return (Array.IndexOf(validTypes, o.Type) != -1) || (nullable && (o.Type == JTokenType.Null || o.Type == JTokenType.Undefined)); return (Array.IndexOf(validTypes, o.Type) != -1) || (nullable && (o.Type == JTokenType.Null || o.Type == JTokenType.Undefined));
} }
#region Cast from operators #region Cast from operators
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Newtonsoft.Json.Linq.JToken"/> to <see cref="System.Boolean"/>. /// Performs an explicit conversion from <see cref="Newtonsoft.Json.Linq.JToken"/> to <see cref="System.Boolean"/>.
/// </summary> /// </summary>
@ -1497,9 +1497,9 @@ namespace LC.Newtonsoft.Json.Linq
return ConvertUtils.ToBigInteger(v.Value); return ConvertUtils.ToBigInteger(v.Value);
} }
#endif #endif
#endregion #endregion
#region Cast to operators #region Cast to operators
/// <summary> /// <summary>
/// Performs an implicit conversion from <see cref="Boolean"/> to <see cref="JToken"/>. /// Performs an implicit conversion from <see cref="Boolean"/> to <see cref="JToken"/>.
/// </summary> /// </summary>
@ -1863,7 +1863,7 @@ namespace LC.Newtonsoft.Json.Linq
{ {
return new JValue(value); return new JValue(value);
} }
#endregion #endregion
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
{ {
@ -1929,9 +1929,12 @@ namespace LC.Newtonsoft.Json.Linq
/// </summary> /// </summary>
/// <typeparam name="T">The object type that the token will be deserialized to.</typeparam> /// <typeparam name="T">The object type that the token will be deserialized to.</typeparam>
/// <returns>The new object created from the JSON value.</returns> /// <returns>The new object created from the JSON value.</returns>
public T? ToObject<T>() [return: MaybeNull]
public T ToObject<T>()
{ {
return (T?)ToObject(typeof(T)); #pragma warning disable CS8601 // Possible null reference assignment.
return (T)ToObject(typeof(T));
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>
@ -2062,9 +2065,12 @@ namespace LC.Newtonsoft.Json.Linq
/// <typeparam name="T">The object type that the token will be deserialized to.</typeparam> /// <typeparam name="T">The object type that the token will be deserialized to.</typeparam>
/// <param name="jsonSerializer">The <see cref="JsonSerializer"/> that will be used when creating the object.</param> /// <param name="jsonSerializer">The <see cref="JsonSerializer"/> that will be used when creating the object.</param>
/// <returns>The new object created from the JSON value.</returns> /// <returns>The new object created from the JSON value.</returns>
public T? ToObject<T>(JsonSerializer jsonSerializer) [return: MaybeNull]
public T ToObject<T>(JsonSerializer jsonSerializer)
{ {
return (T?)ToObject(typeof(T), jsonSerializer); #pragma warning disable CS8601 // Possible null reference assignment.
return (T)ToObject(typeof(T), jsonSerializer);
#pragma warning restore CS8601 // Possible null reference assignment.
} }
/// <summary> /// <summary>
@ -2307,7 +2313,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns>A <see cref="JToken"/>, or <c>null</c>.</returns> /// <returns>A <see cref="JToken"/>, or <c>null</c>.</returns>
public JToken? SelectToken(string path) public JToken? SelectToken(string path)
{ {
return SelectToken(path, settings: null); return SelectToken(path, false);
} }
/// <summary> /// <summary>
@ -2319,28 +2325,11 @@ namespace LC.Newtonsoft.Json.Linq
/// <param name="errorWhenNoMatch">A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.</param> /// <param name="errorWhenNoMatch">A flag to indicate whether an error should be thrown if no tokens are found when evaluating part of the expression.</param>
/// <returns>A <see cref="JToken"/>.</returns> /// <returns>A <see cref="JToken"/>.</returns>
public JToken? SelectToken(string path, bool errorWhenNoMatch) public JToken? SelectToken(string path, bool errorWhenNoMatch)
{
JsonSelectSettings? settings = errorWhenNoMatch
? new JsonSelectSettings { ErrorWhenNoMatch = true }
: null;
return SelectToken(path, settings);
}
/// <summary>
/// Selects a <see cref="JToken"/> using a JSONPath expression. Selects the token that matches the object path.
/// </summary>
/// <param name="path">
/// A <see cref="String"/> that contains a JSONPath expression.
/// </param>
/// <param name="settings">The <see cref="JsonSelectSettings"/> used to select tokens.</param>
/// <returns>A <see cref="JToken"/>.</returns>
public JToken? SelectToken(string path, JsonSelectSettings? settings)
{ {
JPath p = new JPath(path); JPath p = new JPath(path);
JToken? token = null; JToken? token = null;
foreach (JToken t in p.Evaluate(this, this, settings)) foreach (JToken t in p.Evaluate(this, this, errorWhenNoMatch))
{ {
if (token != null) if (token != null)
{ {
@ -2362,7 +2351,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the selected elements.</returns> /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the selected elements.</returns>
public IEnumerable<JToken> SelectTokens(string path) public IEnumerable<JToken> SelectTokens(string path)
{ {
return SelectTokens(path, settings: null); return SelectTokens(path, false);
} }
/// <summary> /// <summary>
@ -2375,25 +2364,8 @@ namespace LC.Newtonsoft.Json.Linq
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the selected elements.</returns> /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the selected elements.</returns>
public IEnumerable<JToken> SelectTokens(string path, bool errorWhenNoMatch) public IEnumerable<JToken> SelectTokens(string path, bool errorWhenNoMatch)
{ {
JsonSelectSettings? settings = errorWhenNoMatch JPath p = new JPath(path);
? new JsonSelectSettings { ErrorWhenNoMatch = true } return p.Evaluate(this, this, errorWhenNoMatch);
: null;
return SelectTokens(path, settings);
}
/// <summary>
/// Selects a collection of elements using a JSONPath expression.
/// </summary>
/// <param name="path">
/// A <see cref="String"/> that contains a JSONPath expression.
/// </param>
/// <param name="settings">The <see cref="JsonSelectSettings"/> used to select tokens.</param>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="JToken"/> that contains the selected elements.</returns>
public IEnumerable<JToken> SelectTokens(string path, JsonSelectSettings? settings)
{
var p = new JPath(path);
return p.Evaluate(this, this, settings);
} }
#if HAVE_DYNAMIC #if HAVE_DYNAMIC
@ -2734,17 +2706,5 @@ namespace LC.Newtonsoft.Json.Linq
} }
} }
} }
internal void CopyAnnotations(JToken target, JToken source)
{
if (source._annotations is object[] annotations)
{
target._annotations = annotations.ToArray();
}
else
{
target._annotations = source._annotations;
}
}
} }
} }

View File

@ -196,11 +196,7 @@ namespace LC.Newtonsoft.Json.Linq
{ {
if (_parent != null) if (_parent != null)
{ {
// TryAdd will return false if an invalid JToken type is added. _parent.Add(value);
// For example, a JComment can't be added to a JObject.
// If there is an invalid JToken type then skip it.
if (_parent.TryAdd(value))
{
_current = _parent.Last; _current = _parent.Last;
if (_parent.Type == JTokenType.Property) if (_parent.Type == JTokenType.Property)
@ -208,7 +204,6 @@ namespace LC.Newtonsoft.Json.Linq
_parent = _parent.Parent; _parent = _parent.Parent;
} }
} }
}
else else
{ {
_value = value ?? JValue.CreateNull(); _value = value ?? JValue.CreateNull();

View File

@ -64,7 +64,6 @@ namespace LC.Newtonsoft.Json.Linq
public JValue(JValue other) public JValue(JValue other)
: this(other.Value, other.Type) : this(other.Value, other.Type)
{ {
CopyAnnotations(this, other);
} }
/// <summary> /// <summary>
@ -842,7 +841,7 @@ namespace LC.Newtonsoft.Json.Linq
/// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>. /// <c>true</c> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <c>false</c>.
/// </returns> /// </returns>
/// <param name="other">An object to compare with this object.</param> /// <param name="other">An object to compare with this object.</param>
public bool Equals(JValue? other) public bool Equals([AllowNull] JValue other)
{ {
if (other == null) if (other == null)
{ {

View File

@ -8,13 +8,13 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
public int? Index { get; set; } public int? Index { get; set; }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
if (Index != null) if (Index != null)
{ {
JToken? v = GetTokenIndex(t, settings, Index.GetValueOrDefault()); JToken? v = GetTokenIndex(t, errorWhenNoMatch, Index.GetValueOrDefault());
if (v != null) if (v != null)
{ {
@ -32,7 +32,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Index * not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name)); throw new JsonException("Index * not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name));
} }

View File

@ -11,13 +11,13 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Indexes = indexes; Indexes = indexes;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
foreach (int i in Indexes) foreach (int i in Indexes)
{ {
JToken? v = GetTokenIndex(t, settings, i); JToken? v = GetTokenIndex(t, errorWhenNoMatch, i);
if (v != null) if (v != null)
{ {

View File

@ -11,7 +11,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
public int? End { get; set; } public int? End { get; set; }
public int? Step { get; set; } public int? Step { get; set; }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
if (Step == 0) if (Step == 0)
{ {
@ -56,7 +56,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Array slice of {0} to {1} returned no results.".FormatWith(CultureInfo.InvariantCulture, throw new JsonException("Array slice of {0} to {1} returned no results.".FormatWith(CultureInfo.InvariantCulture,
Start != null ? Start.GetValueOrDefault().ToString(CultureInfo.InvariantCulture) : "*", Start != null ? Start.GetValueOrDefault().ToString(CultureInfo.InvariantCulture) : "*",
@ -66,7 +66,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Array slice is not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name)); throw new JsonException("Array slice is not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name));
} }

View File

@ -13,7 +13,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Name = name; Name = name;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
@ -27,7 +27,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
yield return v; yield return v;
} }
else if (settings?.ErrorWhenNoMatch ?? false) else if (errorWhenNoMatch)
{ {
throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, Name)); throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, Name));
} }
@ -42,7 +42,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Property '{0}' not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, Name ?? "*", t.GetType().Name)); throw new JsonException("Property '{0}' not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, Name ?? "*", t.GetType().Name));
} }

View File

@ -18,7 +18,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Names = names; Names = names;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
@ -33,7 +33,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
yield return v; yield return v;
} }
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, name)); throw new JsonException("Property '{0}' does not exist on JObject.".FormatWith(CultureInfo.InvariantCulture, name));
} }
@ -41,7 +41,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Properties {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, string.Join(", ", Names.Select(n => "'" + n + "'") throw new JsonException("Properties {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, string.Join(", ", Names.Select(n => "'" + n + "'")
#if !HAVE_STRING_JOIN_WITH_ENUMERABLE #if !HAVE_STRING_JOIN_WITH_ENUMERABLE

View File

@ -874,17 +874,17 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
} }
internal IEnumerable<JToken> Evaluate(JToken root, JToken t, JsonSelectSettings? settings) internal IEnumerable<JToken> Evaluate(JToken root, JToken t, bool errorWhenNoMatch)
{ {
return Evaluate(Filters, root, t, settings); return Evaluate(Filters, root, t, errorWhenNoMatch);
} }
internal static IEnumerable<JToken> Evaluate(List<PathFilter> filters, JToken root, JToken t, JsonSelectSettings? settings) internal static IEnumerable<JToken> Evaluate(List<PathFilter> filters, JToken root, JToken t, bool errorWhenNoMatch)
{ {
IEnumerable<JToken> current = new[] { t }; IEnumerable<JToken> current = new[] { t };
foreach (PathFilter filter in filters) foreach (PathFilter filter in filters)
{ {
current = filter.ExecuteFilter(root, current, settings); current = filter.ExecuteFilter(root, current, errorWhenNoMatch);
} }
return current; return current;

View File

@ -6,15 +6,15 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
internal abstract class PathFilter internal abstract class PathFilter
{ {
public abstract IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings); public abstract IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch);
protected static JToken? GetTokenIndex(JToken t, JsonSelectSettings? settings, int index) protected static JToken? GetTokenIndex(JToken t, bool errorWhenNoMatch, int index)
{ {
if (t is JArray a) if (t is JArray a)
{ {
if (a.Count <= index) if (a.Count <= index)
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Index {0} outside the bounds of JArray.".FormatWith(CultureInfo.InvariantCulture, index)); throw new JsonException("Index {0} outside the bounds of JArray.".FormatWith(CultureInfo.InvariantCulture, index));
} }
@ -28,7 +28,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
if (c.Count <= index) if (c.Count <= index)
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Index {0} outside the bounds of JConstructor.".FormatWith(CultureInfo.InvariantCulture, index)); throw new JsonException("Index {0} outside the bounds of JConstructor.".FormatWith(CultureInfo.InvariantCulture, index));
} }
@ -40,7 +40,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (settings?.ErrorWhenNoMatch ?? false) if (errorWhenNoMatch)
{ {
throw new JsonException("Index {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, index, t.GetType().Name)); throw new JsonException("Index {0} not valid on {1}.".FormatWith(CultureInfo.InvariantCulture, index, t.GetType().Name));
} }

View File

@ -39,13 +39,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Operator = @operator; Operator = @operator;
} }
// For unit tests public abstract bool IsMatch(JToken root, JToken t);
public bool IsMatch(JToken root, JToken t)
{
return IsMatch(root, t, null);
}
public abstract bool IsMatch(JToken root, JToken t, JsonSelectSettings? settings);
} }
internal class CompositeExpression : QueryExpression internal class CompositeExpression : QueryExpression
@ -57,14 +51,14 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Expressions = new List<QueryExpression>(); Expressions = new List<QueryExpression>();
} }
public override bool IsMatch(JToken root, JToken t, JsonSelectSettings? settings) public override bool IsMatch(JToken root, JToken t)
{ {
switch (Operator) switch (Operator)
{ {
case QueryOperator.And: case QueryOperator.And:
foreach (QueryExpression e in Expressions) foreach (QueryExpression e in Expressions)
{ {
if (!e.IsMatch(root, t, settings)) if (!e.IsMatch(root, t))
{ {
return false; return false;
} }
@ -73,7 +67,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
case QueryOperator.Or: case QueryOperator.Or:
foreach (QueryExpression e in Expressions) foreach (QueryExpression e in Expressions)
{ {
if (e.IsMatch(root, t, settings)) if (e.IsMatch(root, t))
{ {
return true; return true;
} }
@ -105,13 +99,13 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
if (o is List<PathFilter> pathFilters) if (o is List<PathFilter> pathFilters)
{ {
return JPath.Evaluate(pathFilters, root, t, null); return JPath.Evaluate(pathFilters, root, t, false);
} }
return CollectionUtils.ArrayEmpty<JToken>(); return CollectionUtils.ArrayEmpty<JToken>();
} }
public override bool IsMatch(JToken root, JToken t, JsonSelectSettings? settings) public override bool IsMatch(JToken root, JToken t)
{ {
if (Operator == QueryOperator.Exists) if (Operator == QueryOperator.Exists)
{ {
@ -130,7 +124,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
JToken leftResult = leftResults.Current; JToken leftResult = leftResults.Current;
foreach (JToken rightResult in rightResults) foreach (JToken rightResult in rightResults)
{ {
if (MatchTokens(leftResult, rightResult, settings)) if (MatchTokens(leftResult, rightResult))
{ {
return true; return true;
} }
@ -142,14 +136,14 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
return false; return false;
} }
private bool MatchTokens(JToken leftResult, JToken rightResult, JsonSelectSettings? settings) private bool MatchTokens(JToken leftResult, JToken rightResult)
{ {
if (leftResult is JValue leftValue && rightResult is JValue rightValue) if (leftResult is JValue leftValue && rightResult is JValue rightValue)
{ {
switch (Operator) switch (Operator)
{ {
case QueryOperator.RegexEquals: case QueryOperator.RegexEquals:
if (RegexEquals(leftValue, rightValue, settings)) if (RegexEquals(leftValue, rightValue))
{ {
return true; return true;
} }
@ -221,7 +215,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
return false; return false;
} }
private static bool RegexEquals(JValue input, JValue pattern, JsonSelectSettings? settings) private static bool RegexEquals(JValue input, JValue pattern)
{ {
if (input.Type != JTokenType.String || pattern.Type != JTokenType.String) if (input.Type != JTokenType.String || pattern.Type != JTokenType.String)
{ {
@ -234,12 +228,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
string patternText = regexText.Substring(1, patternOptionDelimiterIndex - 1); string patternText = regexText.Substring(1, patternOptionDelimiterIndex - 1);
string optionsText = regexText.Substring(patternOptionDelimiterIndex + 1); string optionsText = regexText.Substring(patternOptionDelimiterIndex + 1);
#if HAVE_REGEX_TIMEOUTS
TimeSpan timeout = settings?.RegexMatchTimeout ?? Regex.InfiniteMatchTimeout;
return Regex.IsMatch((string)input.Value!, patternText, MiscellaneousUtils.GetRegexOptions(optionsText), timeout);
#else
return Regex.IsMatch((string)input.Value!, patternText, MiscellaneousUtils.GetRegexOptions(optionsText)); return Regex.IsMatch((string)input.Value!, patternText, MiscellaneousUtils.GetRegexOptions(optionsText));
#endif
} }
internal static bool EqualsWithStringCoercion(JValue value, JValue queryValue) internal static bool EqualsWithStringCoercion(JValue value, JValue queryValue)

View File

@ -12,13 +12,13 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Expression = expression; Expression = expression;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
foreach (JToken v in t) foreach (JToken v in t)
{ {
if (Expression.IsMatch(root, v, settings)) if (Expression.IsMatch(root, v))
{ {
yield return v; yield return v;
} }

View File

@ -12,7 +12,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Expression = expression; Expression = expression;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken t in current) foreach (JToken t in current)
{ {
@ -20,7 +20,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
foreach (JToken d in c.DescendantsAndSelf()) foreach (JToken d in c.DescendantsAndSelf())
{ {
if (Expression.IsMatch(root, d, settings)) if (Expression.IsMatch(root, d))
{ {
yield return d; yield return d;
} }
@ -28,7 +28,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
} }
else else
{ {
if (Expression.IsMatch(root, t, settings)) if (Expression.IsMatch(root, t))
{ {
yield return t; yield return t;
} }

View File

@ -10,7 +10,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
{ {
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
return new[] { root }; return new[] { root };
} }

View File

@ -11,7 +11,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
Name = name; Name = name;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken c in current) foreach (JToken c in current)
{ {

View File

@ -11,7 +11,7 @@ namespace LC.Newtonsoft.Json.Linq.JsonPath
_names = names; _names = names;
} }
public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings) public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, bool errorWhenNoMatch)
{ {
foreach (JToken c in current) foreach (JToken c in current)
{ {

View File

@ -1,28 +0,0 @@
using System;
namespace LC.Newtonsoft.Json.Linq
{
/// <summary>
/// Specifies the settings used when selecting JSON.
/// </summary>
public class JsonSelectSettings
{
#if HAVE_REGEX_TIMEOUTS
/// <summary>
/// Gets or sets a timeout that will be used when executing regular expressions.
/// </summary>
/// <value>The timeout that will be used when executing regular expressions.</value>
public TimeSpan? RegexMatchTimeout { get; set; }
#endif
/// <summary>
/// Gets or sets a flag that indicates whether an error should be thrown if
/// no tokens are found when evaluating part of the expression.
/// </summary>
/// <value>
/// A flag that indicates whether an error should be thrown if
/// no tokens are found when evaluating part of the expression.
/// </value>
public bool ErrorWhenNoMatch { get; set; }
}
}

View File

@ -1,18 +0,0 @@
<linker>
<assembly fullname="System">
<!-- No issue on these, though they are quite commonly used. -->
<type fullname="System.ComponentModel.*Converter" preserve="all"/>
</assembly>
<assembly fullname="Newtonsoft.Json">
<!-- https://github.com/jilleJr/Newtonsoft.Json-for-Unity/issues/54 -->
<type fullname="System.Runtime.CompilerServices.NullableAttribute"/>
<type fullname="System.Runtime.CompilerServices.NullableContextAttribute"/>
<!-- https://github.com/jilleJr/Newtonsoft.Json-for-Unity/issues/8 -->
<!-- https://github.com/jilleJr/Newtonsoft.Json-for-Unity/issues/65 -->
<type fullname="Newtonsoft.Json.Converters.*Converter" preserve="all" />
<!-- No issue on these, though they are quite commonly used. -->
<type fullname="Newtonsoft.Json.Serialization.*NamingStrategy" preserve="all" />
</assembly>
</linker>

View File

@ -118,21 +118,21 @@ namespace LC.Newtonsoft.Json.Serialization
Type? keyType; Type? keyType;
Type? valueType; Type? valueType;
if (ReflectionUtils.ImplementsGenericDefinition(NonNullableUnderlyingType, typeof(IDictionary<,>), out _genericCollectionDefinitionType)) if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IDictionary<,>), out _genericCollectionDefinitionType))
{ {
keyType = _genericCollectionDefinitionType.GetGenericArguments()[0]; keyType = _genericCollectionDefinitionType.GetGenericArguments()[0];
valueType = _genericCollectionDefinitionType.GetGenericArguments()[1]; valueType = _genericCollectionDefinitionType.GetGenericArguments()[1];
if (ReflectionUtils.IsGenericDefinition(NonNullableUnderlyingType, typeof(IDictionary<,>))) if (ReflectionUtils.IsGenericDefinition(UnderlyingType, typeof(IDictionary<,>)))
{ {
CreatedType = typeof(Dictionary<,>).MakeGenericType(keyType, valueType); CreatedType = typeof(Dictionary<,>).MakeGenericType(keyType, valueType);
} }
else if (NonNullableUnderlyingType.IsGenericType()) else if (underlyingType.IsGenericType())
{ {
// ConcurrentDictionary<,> + IDictionary setter + null value = error // ConcurrentDictionary<,> + IDictionary setter + null value = error
// wrap to use generic setter // wrap to use generic setter
// https://github.com/JamesNK/Newtonsoft.Json/issues/1582 // https://github.com/JamesNK/Newtonsoft.Json/issues/1582
Type typeDefinition = NonNullableUnderlyingType.GetGenericTypeDefinition(); Type typeDefinition = underlyingType.GetGenericTypeDefinition();
if (typeDefinition.FullName == JsonTypeReflector.ConcurrentDictionaryTypeName) if (typeDefinition.FullName == JsonTypeReflector.ConcurrentDictionaryTypeName)
{ {
ShouldCreateWrapper = true; ShouldCreateWrapper = true;
@ -140,17 +140,17 @@ namespace LC.Newtonsoft.Json.Serialization
} }
#if HAVE_READ_ONLY_COLLECTIONS #if HAVE_READ_ONLY_COLLECTIONS
IsReadOnlyOrFixedSize = ReflectionUtils.InheritsGenericDefinition(NonNullableUnderlyingType, typeof(ReadOnlyDictionary<,>)); IsReadOnlyOrFixedSize = ReflectionUtils.InheritsGenericDefinition(underlyingType, typeof(ReadOnlyDictionary<,>));
#endif #endif
} }
#if HAVE_READ_ONLY_COLLECTIONS #if HAVE_READ_ONLY_COLLECTIONS
else if (ReflectionUtils.ImplementsGenericDefinition(NonNullableUnderlyingType, typeof(IReadOnlyDictionary<,>), out _genericCollectionDefinitionType)) else if (ReflectionUtils.ImplementsGenericDefinition(underlyingType, typeof(IReadOnlyDictionary<,>), out _genericCollectionDefinitionType))
{ {
keyType = _genericCollectionDefinitionType.GetGenericArguments()[0]; keyType = _genericCollectionDefinitionType.GetGenericArguments()[0];
valueType = _genericCollectionDefinitionType.GetGenericArguments()[1]; valueType = _genericCollectionDefinitionType.GetGenericArguments()[1];
if (ReflectionUtils.IsGenericDefinition(NonNullableUnderlyingType, typeof(IReadOnlyDictionary<,>))) if (ReflectionUtils.IsGenericDefinition(UnderlyingType, typeof(IReadOnlyDictionary<,>)))
{ {
CreatedType = typeof(ReadOnlyDictionary<,>).MakeGenericType(keyType, valueType); CreatedType = typeof(ReadOnlyDictionary<,>).MakeGenericType(keyType, valueType);
} }
@ -160,9 +160,9 @@ namespace LC.Newtonsoft.Json.Serialization
#endif #endif
else else
{ {
ReflectionUtils.GetDictionaryKeyValueTypes(NonNullableUnderlyingType, out keyType, out valueType); ReflectionUtils.GetDictionaryKeyValueTypes(UnderlyingType, out keyType, out valueType);
if (NonNullableUnderlyingType == typeof(IDictionary)) if (UnderlyingType == typeof(IDictionary))
{ {
CreatedType = typeof(Dictionary<object, object>); CreatedType = typeof(Dictionary<object, object>);
} }
@ -176,9 +176,9 @@ namespace LC.Newtonsoft.Json.Serialization
typeof(IDictionary<,>).MakeGenericType(keyType, valueType)); typeof(IDictionary<,>).MakeGenericType(keyType, valueType));
#if HAVE_FSHARP_TYPES #if HAVE_FSHARP_TYPES
if (!HasParameterizedCreatorInternal && NonNullableUnderlyingType.Name == FSharpUtils.FSharpMapTypeName) if (!HasParameterizedCreatorInternal && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
{ {
FSharpUtils.EnsureInitialized(NonNullableUnderlyingType.Assembly()); FSharpUtils.EnsureInitialized(underlyingType.Assembly());
_parameterizedCreator = FSharpUtils.Instance.CreateMap(keyType, valueType); _parameterizedCreator = FSharpUtils.Instance.CreateMap(keyType, valueType);
} }
#endif #endif
@ -207,7 +207,7 @@ namespace LC.Newtonsoft.Json.Serialization
if (DictionaryKeyType != null && if (DictionaryKeyType != null &&
DictionaryValueType != null && DictionaryValueType != null &&
ImmutableCollectionsUtils.TryBuildImmutableForDictionaryContract( ImmutableCollectionsUtils.TryBuildImmutableForDictionaryContract(
NonNullableUnderlyingType, underlyingType,
DictionaryKeyType, DictionaryKeyType,
DictionaryValueType, DictionaryValueType,
out Type? immutableCreatedType, out Type? immutableCreatedType,

View File

@ -238,15 +238,6 @@ namespace LC.Newtonsoft.Json.Serialization
token = writer.Token; token = writer.Token;
} }
if (contract != null && token != null)
{
if (!contract.UnderlyingType.IsAssignableFrom(token.GetType()))
{
throw JsonSerializationException.Create(reader, "Deserialized JSON type '{0}' is not compatible with expected type '{1}'."
.FormatWith(CultureInfo.InvariantCulture, token.GetType().FullName, contract.UnderlyingType.FullName));
}
}
return token; return token;
} }
@ -598,7 +589,7 @@ namespace LC.Newtonsoft.Json.Serialization
throw JsonSerializationException.Create(reader, message); throw JsonSerializationException.Create(reader, message);
} }
private bool ReadMetadataPropertiesToken(JTokenReader reader, ref Type? objectType, ref JsonContract? contract, JsonProperty? member, JsonContainerContract? containerContract, JsonProperty? containerMember, object? existingValue, out object? newValue, out string? id) private bool ReadMetadataPropertiesToken(JTokenReader reader, ref Type? objectType, ref JsonContract? contract, JsonProperty? member, JsonContainerContract? containerContract, JsonProperty? containerMember, object? existingValue, [NotNullWhen(true)]out object? newValue, out string? id)
{ {
id = null; id = null;
newValue = null; newValue = null;
@ -967,11 +958,7 @@ namespace LC.Newtonsoft.Json.Serialization
{ {
if (value is string s) if (value is string s)
{ {
return EnumUtils.ParseEnum( return EnumUtils.ParseEnum(contract.NonNullableUnderlyingType, null, s, false);
contract.NonNullableUnderlyingType,
null,
s,
false);
} }
if (ConvertUtils.IsInteger(primitiveContract.TypeCode)) if (ConvertUtils.IsInteger(primitiveContract.TypeCode))
{ {
@ -1400,7 +1387,7 @@ namespace LC.Newtonsoft.Json.Serialization
{ {
keyValue = DateTimeUtils.TryParseDateTime(keyValue.ToString(), reader.DateTimeZoneHandling, reader.DateFormatString, reader.Culture, out DateTime dt) keyValue = DateTimeUtils.TryParseDateTime(keyValue.ToString(), reader.DateTimeZoneHandling, reader.DateFormatString, reader.Culture, out DateTime dt)
? dt ? dt
: EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract, contract.DictionaryKeyType)!; : EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract!, contract.DictionaryKeyType)!;
break; break;
} }
#if HAVE_DATE_TIME_OFFSET #if HAVE_DATE_TIME_OFFSET
@ -1409,14 +1396,12 @@ namespace LC.Newtonsoft.Json.Serialization
{ {
keyValue = DateTimeUtils.TryParseDateTimeOffset(keyValue.ToString(), reader.DateFormatString, reader.Culture, out DateTimeOffset dt) keyValue = DateTimeUtils.TryParseDateTimeOffset(keyValue.ToString(), reader.DateFormatString, reader.Culture, out DateTimeOffset dt)
? dt ? dt
: EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract, contract.DictionaryKeyType)!; : EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract!, contract.DictionaryKeyType)!;
break; break;
} }
#endif #endif
default: default:
keyValue = contract.KeyContract != null && contract.KeyContract.IsEnum keyValue = EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract!, contract.DictionaryKeyType)!;
? EnumUtils.ParseEnum(contract.KeyContract.NonNullableUnderlyingType, (Serializer._contractResolver as DefaultContractResolver)?.NamingStrategy, keyValue.ToString(), false)
: EnsureType(reader, keyValue, CultureInfo.InvariantCulture, contract.KeyContract, contract.DictionaryKeyType)!;
break; break;
} }
} }
@ -2216,9 +2201,7 @@ namespace LC.Newtonsoft.Json.Serialization
propertyValues.Add(creatorPropertyContext); propertyValues.Add(creatorPropertyContext);
JsonProperty? property = creatorPropertyContext.ConstructorProperty ?? creatorPropertyContext.Property; JsonProperty? property = creatorPropertyContext.ConstructorProperty ?? creatorPropertyContext.Property;
if (property != null) if (property != null && !property.Ignored)
{
if (!property.Ignored)
{ {
if (property.PropertyContract == null) if (property.PropertyContract == null)
{ {
@ -2243,7 +2226,6 @@ namespace LC.Newtonsoft.Json.Serialization
continue; continue;
} }
}
else else
{ {
if (!reader.Read()) if (!reader.Read())

View File

@ -528,7 +528,7 @@ namespace LC.Newtonsoft.Json.Serialization
OnSerialized(writer, contract, value); OnSerialized(writer, contract, value);
} }
private bool CalculatePropertyValues(JsonWriter writer, object value, JsonContainerContract contract, JsonProperty? member, JsonProperty property, [NotNullWhen(true)]out JsonContract? memberContract, out object? memberValue) private bool CalculatePropertyValues(JsonWriter writer, object value, JsonContainerContract contract, JsonProperty? member, JsonProperty property, [NotNullWhen(true)]out JsonContract? memberContract, [NotNullWhen(true)]out object? memberValue)
{ {
if (!property.Ignored && property.Readable && ShouldSerialize(writer, property, value) && IsSpecified(writer, property, value)) if (!property.Ignored && property.Readable && ShouldSerialize(writer, property, value) && IsSpecified(writer, property, value))
{ {
@ -542,14 +542,14 @@ namespace LC.Newtonsoft.Json.Serialization
if (ShouldWriteProperty(memberValue, contract as JsonObjectContract, property)) if (ShouldWriteProperty(memberValue, contract as JsonObjectContract, property))
{ {
if (ShouldWriteReference(memberValue, property, memberContract, contract, member)) if (ShouldWriteReference(memberValue, property, memberContract!, contract, member))
{ {
property.WritePropertyName(writer); property.WritePropertyName(writer);
WriteReference(writer, memberValue!); WriteReference(writer, memberValue!);
return false; return false;
} }
if (!CheckForCircularReference(writer, memberValue, property, memberContract, contract, member)) if (!CheckForCircularReference(writer, memberValue, property, memberContract!, contract, member))
{ {
return false; return false;
} }
@ -568,9 +568,7 @@ namespace LC.Newtonsoft.Json.Serialization
} }
} }
#pragma warning disable CS8762 // Parameter must have a non-null value when exiting in some condition.
return true; return true;
#pragma warning restore CS8762 // Parameter must have a non-null value when exiting in some condition.
} }
} }

View File

@ -61,9 +61,9 @@ namespace LC.Newtonsoft.Json.Utilities
public static Task<T> FromCanceled<T>(this CancellationToken cancellationToken) public static Task<T> FromCanceled<T>(this CancellationToken cancellationToken)
{ {
MiscellaneousUtils.Assert(cancellationToken.IsCancellationRequested); MiscellaneousUtils.Assert(cancellationToken.IsCancellationRequested);
#pragma warning disable CS8603 // Possible null reference return. #pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
return new Task<T>(() => default, cancellationToken); return new Task<T>(() => default, cancellationToken);
#pragma warning restore CS8603 // Possible null reference return. #pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
} }
// Task.Delay(0) is optimised as a cached task within the framework, and indeed // Task.Delay(0) is optimised as a cached task within the framework, and indeed

View File

@ -179,9 +179,9 @@ namespace LC.Newtonsoft.Json.Utilities
internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime, TimeSpan offset) internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime, TimeSpan offset)
{ {
long universalTicks = ToUniversalTicks(dateTime, offset); long universialTicks = ToUniversalTicks(dateTime, offset);
return UniversalTicksToJavaScriptTicks(universalTicks); return UniversialTicksToJavaScriptTicks(universialTicks);
} }
internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime) internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime)
@ -193,12 +193,12 @@ namespace LC.Newtonsoft.Json.Utilities
{ {
long ticks = (convertToUtc) ? ToUniversalTicks(dateTime) : dateTime.Ticks; long ticks = (convertToUtc) ? ToUniversalTicks(dateTime) : dateTime.Ticks;
return UniversalTicksToJavaScriptTicks(ticks); return UniversialTicksToJavaScriptTicks(ticks);
} }
private static long UniversalTicksToJavaScriptTicks(long universalTicks) private static long UniversialTicksToJavaScriptTicks(long universialTicks)
{ {
long javaScriptTicks = (universalTicks - InitialJavaScriptDateTicks) / 10000; long javaScriptTicks = (universialTicks - InitialJavaScriptDateTicks) / 10000;
return javaScriptTicks; return javaScriptTicks;
} }

View File

@ -166,9 +166,7 @@ namespace LC.Newtonsoft.Json.Utilities
} }
} }
#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). public bool TryGetValue(TKey key, [MaybeNull]out TValue value)
public bool TryGetValue(TKey key, out TValue? value)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).
{ {
if (_dictionary != null) if (_dictionary != null)
{ {
@ -492,12 +490,8 @@ namespace LC.Newtonsoft.Json.Utilities
#endif #endif
else else
{ {
// Consider changing this code to call GenericDictionary.Remove when value is null.
//
#pragma warning disable CS8601 // Possible null reference assignment. #pragma warning disable CS8601 // Possible null reference assignment.
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
GenericDictionary[(TKey)key] = (TValue)value; GenericDictionary[(TKey)key] = (TValue)value;
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning restore CS8601 // Possible null reference assignment. #pragma warning restore CS8601 // Possible null reference assignment.
} }
} }

View File

@ -629,7 +629,7 @@ namespace LC.Newtonsoft.Json.Utilities
return true; return true;
} }
private static bool TryGetDateConstructorValue(JsonReader reader, out long? integer, [NotNullWhen(false)] out string? errorMessage) private static bool TryGetDateConstructorValue(JsonReader reader, out long? integer, out string? errorMessage)
{ {
integer = null; integer = null;
errorMessage = null; errorMessage = null;

View File

@ -195,7 +195,7 @@ namespace LC.Newtonsoft.Json.Utilities
private static char ToLower(char c) private static char ToLower(char c)
{ {
#if HAVE_CHAR_TO_LOWER_WITH_CULTURE #if HAVE_CHAR_TO_STRING_WITH_CULTURE
c = char.ToLower(c, CultureInfo.InvariantCulture); c = char.ToLower(c, CultureInfo.InvariantCulture);
#else #else
c = char.ToLowerInvariant(c); c = char.ToLowerInvariant(c);

View File

@ -37,8 +37,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Storage.Test", "Storage\Sto
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Google.Protobuf", "Libs\Google.Protobuf\LC.Google.Protobuf.csproj", "{B3BB497E-D654-4680-8312-ABCC12FFBBB2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Google.Protobuf", "Libs\Google.Protobuf\LC.Google.Protobuf.csproj", "{B3BB497E-D654-4680-8312-ABCC12FFBBB2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json.AOT", "Libs\Newtonsoft.Json.AOT\LC.Newtonsoft.Json.AOT.csproj", "{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json", "Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj", "{9808CC82-171F-4046-A252-AA1C5C5BC222}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json", "Libs\Newtonsoft.Json\LC.Newtonsoft.Json.csproj", "{9808CC82-171F-4046-A252-AA1C5C5BC222}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.AOT", "Common\Common.AOT\Common.AOT.csproj", "{BF90B92D-84D1-47DD-99D4-91C33A229FF9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.AOT", "Common\Common.AOT\Common.AOT.csproj", "{BF90B92D-84D1-47DD-99D4-91C33A229FF9}"
@ -49,6 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Realtime.AOT", "Realtime\Re
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveQuery.AOT", "LiveQuery\LiveQuery.AOT\LiveQuery.AOT.csproj", "{5BE8789B-56C6-444F-87BF-F9447EE1E128}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveQuery.AOT", "LiveQuery\LiveQuery.AOT\LiveQuery.AOT.csproj", "{5BE8789B-56C6-444F-87BF-F9447EE1E128}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LC.Newtonsoft.Json.AOT", "Libs\Newtonsoft.Json.AOT\LC.Newtonsoft.Json.AOT.csproj", "{531106D1-CFEA-4396-95F0-79EBCD85EAB1}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -99,10 +99,6 @@ Global
{B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Release|Any CPU.Build.0 = Release|Any CPU {B3BB497E-D654-4680-8312-ABCC12FFBBB2}.Release|Any CPU.Build.0 = Release|Any CPU
{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE}.Release|Any CPU.Build.0 = Release|Any CPU
{9808CC82-171F-4046-A252-AA1C5C5BC222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9808CC82-171F-4046-A252-AA1C5C5BC222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9808CC82-171F-4046-A252-AA1C5C5BC222}.Debug|Any CPU.Build.0 = Debug|Any CPU {9808CC82-171F-4046-A252-AA1C5C5BC222}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9808CC82-171F-4046-A252-AA1C5C5BC222}.Release|Any CPU.ActiveCfg = Release|Any CPU {9808CC82-171F-4046-A252-AA1C5C5BC222}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -123,6 +119,10 @@ Global
{5BE8789B-56C6-444F-87BF-F9447EE1E128}.Debug|Any CPU.Build.0 = Debug|Any CPU {5BE8789B-56C6-444F-87BF-F9447EE1E128}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BE8789B-56C6-444F-87BF-F9447EE1E128}.Release|Any CPU.ActiveCfg = Release|Any CPU {5BE8789B-56C6-444F-87BF-F9447EE1E128}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BE8789B-56C6-444F-87BF-F9447EE1E128}.Release|Any CPU.Build.0 = Release|Any CPU {5BE8789B-56C6-444F-87BF-F9447EE1E128}.Release|Any CPU.Build.0 = Release|Any CPU
{531106D1-CFEA-4396-95F0-79EBCD85EAB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{531106D1-CFEA-4396-95F0-79EBCD85EAB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{531106D1-CFEA-4396-95F0-79EBCD85EAB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{531106D1-CFEA-4396-95F0-79EBCD85EAB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{4194FE34-327C-42C2-971F-6B07904E20A5} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3} {4194FE34-327C-42C2-971F-6B07904E20A5} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
@ -136,12 +136,12 @@ Global
{0A6AEBC9-9A36-4EA7-8F58-8B951126092D} = {8087ABCD-629C-4EE5-9ECE-8BDAE631236F} {0A6AEBC9-9A36-4EA7-8F58-8B951126092D} = {8087ABCD-629C-4EE5-9ECE-8BDAE631236F}
{07B8BAE6-CA9A-48B0-9881-F63F1F5DCE70} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3} {07B8BAE6-CA9A-48B0-9881-F63F1F5DCE70} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
{B3BB497E-D654-4680-8312-ABCC12FFBBB2} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D} {B3BB497E-D654-4680-8312-ABCC12FFBBB2} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{ABE172EF-F120-4D69-AA67-5DF2C7FC4FFE} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{9808CC82-171F-4046-A252-AA1C5C5BC222} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D} {9808CC82-171F-4046-A252-AA1C5C5BC222} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
{BF90B92D-84D1-47DD-99D4-91C33A229FF9} = {375B854F-C239-4503-868A-7F04C40582E5} {BF90B92D-84D1-47DD-99D4-91C33A229FF9} = {375B854F-C239-4503-868A-7F04C40582E5}
{81A5200F-6992-4BF5-883B-CE207E6E97DB} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3} {81A5200F-6992-4BF5-883B-CE207E6E97DB} = {076871D0-BE1F-4AF0-B83E-697C71C0C3B3}
{84C9B97C-B084-447A-921F-4F1977F23C94} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A} {84C9B97C-B084-447A-921F-4F1977F23C94} = {319A9989-3B69-4AD0-9E43-F6D31C1D2A4A}
{5BE8789B-56C6-444F-87BF-F9447EE1E128} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17} {5BE8789B-56C6-444F-87BF-F9447EE1E128} = {A1A24E0F-6901-4A9A-9BB8-4F586BC7EE17}
{531106D1-CFEA-4396-95F0-79EBCD85EAB1} = {3B53EFFB-6962-4EED-88FD-F9D6E9650A2D}
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
version = 0.7.1 version = 0.7.1