Fix warnings (#3031)
This commit is contained in:
@@ -192,5 +192,6 @@
|
||||
<AssemblyTitle>Json.NET Tests .NET Standard 1.0</AssemblyTitle>
|
||||
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v1.0</ReferringTargetFrameworkForProjectReferences>
|
||||
<DefineConstants>NETSTANDARD1_0;DNXCORE50;PORTABLE;HAVE_REGEX_TIMEOUTS;$(AdditionalConstants)</DefineConstants>
|
||||
<NoWarn>$(NoWarn);NETSDK1023</NoWarn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -76,10 +76,12 @@ namespace Newtonsoft.Json
|
||||
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
|
||||
/// <exception cref="SerializationException">The class name is <c>null</c> or <see cref="Exception.HResult"/> is zero (0).</exception>
|
||||
#pragma warning disable SYSLIB0051
|
||||
public JsonException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
#pragma warning restore SYSLIB0051
|
||||
#endif
|
||||
|
||||
internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
|
||||
|
||||
@@ -952,12 +952,12 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
|
||||
string ITypedList.GetListName(PropertyDescriptor[]? listAccessors)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors)
|
||||
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[]? listAccessors)
|
||||
{
|
||||
#if HAVE_APPCONTEXT
|
||||
if (!ComponentModelIsSupported)
|
||||
|
||||
@@ -33,6 +33,7 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Serialization
|
||||
{
|
||||
#pragma warning disable SYSLIB0050
|
||||
[RequiresUnreferencedCode(MiscellaneousUtils.TrimWarning)]
|
||||
[RequiresDynamicCode(MiscellaneousUtils.AotWarning)]
|
||||
internal class JsonFormatterConverter : IFormatterConverter
|
||||
@@ -155,6 +156,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
return GetTokenValue<ulong>(value);
|
||||
}
|
||||
}
|
||||
#pragma warning restore SYSLIB0050
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -189,6 +189,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
#endif
|
||||
internal object GetUninitializedObject()
|
||||
{
|
||||
#pragma warning disable SYSLIB0050
|
||||
// we should never get here if the environment is not fully trusted, check just in case
|
||||
if (!JsonTypeReflector.FullyTrusted)
|
||||
{
|
||||
@@ -196,6 +197,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
|
||||
return FormatterServices.GetUninitializedObject(NonNullableUnderlyingType);
|
||||
#pragma warning restore SYSLIB0050
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1758,6 +1758,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
[RequiresDynamicCode(MiscellaneousUtils.AotWarning)]
|
||||
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty? member, string? id)
|
||||
{
|
||||
#pragma warning disable SYSLIB0050
|
||||
Type objectType = contract.UnderlyingType;
|
||||
|
||||
if (!JsonTypeReflector.FullyTrusted)
|
||||
@@ -1826,6 +1827,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
OnDeserialized(reader, contract, createdObject);
|
||||
|
||||
return createdObject;
|
||||
#pragma warning restore SYSLIB0050
|
||||
}
|
||||
|
||||
[RequiresUnreferencedCode(MiscellaneousUtils.TrimWarning)]
|
||||
|
||||
@@ -888,6 +888,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
[RequiresDynamicCode(MiscellaneousUtils.AotWarning)]
|
||||
private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract, JsonProperty? member, JsonContainerContract? collectionContract, JsonProperty? containerProperty)
|
||||
{
|
||||
#pragma warning disable SYSLIB0050
|
||||
if (!JsonTypeReflector.FullyTrusted)
|
||||
{
|
||||
string message = @"Type '{0}' implements ISerializable but cannot be serialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine +
|
||||
@@ -925,6 +926,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
_serializeStack.RemoveAt(_serializeStack.Count - 1);
|
||||
OnSerialized(writer, contract, value);
|
||||
#pragma warning restore SYSLIB0050
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user