using System;
using System.Buffers;
using System.Buffers.Text;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Pipelines;
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Reflection;
using System.Text.Json.Schema;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Converters;
using System.Text.Json.Serialization.Metadata;
using System.Text.RegularExpressions;
using System.Text.Unicode;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using FxResources.System.Text.Json;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: AssemblyMetadata("IsAotCompatible", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides high-performance and low-allocating types that serialize objects to JavaScript Object Notation (JSON) text and deserialize JSON text to objects, with UTF-8 support built-in. Also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM), that is read-only, for random access of the JSON elements within a structured view of the data.\r\n\r\nThe System.Text.Json library is built-in as part of the shared framework in .NET Runtime. The package can be installed when you need to use it in other target frameworks.")]
[assembly: AssemblyFileVersion("10.0.726.21808")]
[assembly: AssemblyInformationalVersion("10.0.7+b16286c2284fecf303dbc12a0bb152476d662e44")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Json")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/dotnet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("10.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsReadOnlyAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsUnmanagedAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsByRefLikeAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class NullablePublicOnlyAttribute : Attribute
{
public readonly bool IncludesInternals;
public NullablePublicOnlyAttribute(bool P_0)
{
IncludesInternals = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class ScopedRefAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class ExtensionMarkerAttribute : Attribute
{
public ExtensionMarkerAttribute(string name)
{
}
}
}
namespace FxResources.System.Text.Json
{
internal static class SR
{
}
}
namespace System
{
internal static class HexConverter
{
public enum Casing : uint
{
Upper = 0u,
Lower = 8224u
}
private ref struct SpanCasingPair
{
public ReadOnlySpan<byte> Bytes { get; set; }
public Casing Casing { get; set; }
}
public static ReadOnlySpan<byte> CharToHexLookup => new byte[256]
{
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
13, 14, 15, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255
};
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
{
uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
buffer[startingIndex + 1] = (byte)num2;
buffer[startingIndex] = (byte)(num2 >> 8);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
{
uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
buffer[startingIndex] = (char)(num2 >> 8);
}
public static void EncodeToUtf8(ReadOnlySpan<byte> source, Span<byte> utf8Destination, Casing casing = Casing.Upper)
{
for (int i = 0; i < source.Length; i++)
{
ToBytesBuffer(source[i], utf8Destination, i * 2, casing);
}
}
public static void EncodeToUtf16(ReadOnlySpan<byte> source, Span<char> destination, Casing casing = Casing.Upper)
{
for (int i = 0; i < source.Length; i++)
{
ToCharsBuffer(source[i], destination, i * 2, casing);
}
}
public static string ToString(ReadOnlySpan<byte> bytes, Casing casing = Casing.Upper)
{
Span<char> span = ((bytes.Length <= 16) ? stackalloc char[bytes.Length * 2] : new char[bytes.Length * 2].AsSpan());
Span<char> buffer = span;
int num = 0;
ReadOnlySpan<byte> readOnlySpan = bytes;
for (int i = 0; i < readOnlySpan.Length; i++)
{
ToCharsBuffer(readOnlySpan[i], buffer, num, casing);
num += 2;
}
return buffer.ToString();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static char ToCharUpper(int value)
{
value &= 0xF;
value += 48;
if (value > 57)
{
value += 7;
}
return (char)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static char ToCharLower(int value)
{
value &= 0xF;
value += 48;
if (value > 57)
{
value += 39;
}
return (char)value;
}
public static bool TryDecodeFromUtf8(ReadOnlySpan<byte> utf8Source, Span<byte> destination, out int bytesProcessed)
{
return TryDecodeFromUtf8_Scalar(utf8Source, destination, out bytesProcessed);
}
public static bool TryDecodeFromUtf16(ReadOnlySpan<char> source, Span<byte> destination, out int charsProcessed)
{
return TryDecodeFromUtf16_Scalar(source, destination, out charsProcessed);
}
private static bool TryDecodeFromUtf8_Scalar(ReadOnlySpan<byte> utf8Source, Span<byte> destination, out int bytesProcessed)
{
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
while (num2 < destination.Length)
{
num3 = FromChar(utf8Source[num + 1]);
num4 = FromChar(utf8Source[num]);
if ((num3 | num4) == 255)
{
break;
}
destination[num2++] = (byte)((num4 << 4) | num3);
num += 2;
}
if (num3 == 255)
{
num++;
}
bytesProcessed = num;
return (num3 | num4) != 255;
}
private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> source, Span<byte> destination, out int charsProcessed)
{
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
while (num2 < destination.Length)
{
num3 = FromChar(source[num + 1]);
num4 = FromChar(source[num]);
if ((num3 | num4) == 255)
{
break;
}
destination[num2++] = (byte)((num4 << 4) | num3);
num += 2;
}
if (num3 == 255)
{
num++;
}
charsProcessed = num;
return (num3 | num4) != 255;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int FromChar(int c)
{
if (c < CharToHexLookup.Length)
{
return CharToHexLookup[c];
}
return 255;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int FromUpperChar(int c)
{
if (c <= 71)
{
return CharToHexLookup[c];
}
return 255;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int FromLowerChar(int c)
{
switch (c)
{
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
return c - 48;
case 97:
case 98:
case 99:
case 100:
case 101:
case 102:
return c - 97 + 10;
default:
return 255;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsHexChar(int c)
{
if (IntPtr.Size == 8)
{
ulong num = (uint)(c - 48);
long num2 = -17875860044349952L << (int)num;
ulong num3 = num - 64;
return (long)((ulong)num2 & num3) < 0L;
}
return FromChar(c) != 255;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsHexUpperChar(int c)
{
if ((uint)(c - 48) > 9u)
{
return (uint)(c - 65) <= 5u;
}
return true;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsHexLowerChar(int c)
{
if ((uint)(c - 48) > 9u)
{
return (uint)(c - 97) <= 5u;
}
return true;
}
}
internal static class Obsoletions
{
internal const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";
internal const string SystemTextEncodingUTF7Message = "The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.";
internal const string SystemTextEncodingUTF7DiagId = "SYSLIB0001";
internal const string PrincipalPermissionAttributeMessage = "PrincipalPermissionAttribute is not honored by the runtime and must not be used.";
internal const string PrincipalPermissionAttributeDiagId = "SYSLIB0002";
internal const string CodeAccessSecurityMessage = "Code Access Security is not supported or honored by the runtime.";
internal const string CodeAccessSecurityDiagId = "SYSLIB0003";
internal const string ConstrainedExecutionRegionMessage = "The Constrained Execution Region (CER) feature is not supported.";
internal const string ConstrainedExecutionRegionDiagId = "SYSLIB0004";
internal const string GlobalAssemblyCacheMessage = "The Global Assembly Cache is not supported.";
internal const string GlobalAssemblyCacheDiagId = "SYSLIB0005";
internal const string ThreadAbortMessage = "Thread.Abort is not supported and throws PlatformNotSupportedException.";
internal const string ThreadResetAbortMessage = "Thread.ResetAbort is not supported and throws PlatformNotSupportedException.";
internal const string ThreadAbortDiagId = "SYSLIB0006";
internal const string DefaultCryptoAlgorithmsMessage = "The default implementation of this cryptography algorithm is not supported.";
internal const string DefaultCryptoAlgorithmsDiagId = "SYSLIB0007";
internal const string CreatePdbGeneratorMessage = "The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException.";
internal const string CreatePdbGeneratorDiagId = "SYSLIB0008";
internal const string AuthenticationManagerMessage = "AuthenticationManager is not supported. Methods will no-op or throw PlatformNotSupportedException.";
internal const string AuthenticationManagerDiagId = "SYSLIB0009";
internal const string RemotingApisMessage = "This Remoting API is not supported and throws PlatformNotSupportedException.";
internal const string RemotingApisDiagId = "SYSLIB0010";
internal const string BinaryFormatterMessage = "BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.";
internal const string BinaryFormatterDiagId = "SYSLIB0011";
internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.";
internal const string CodeBaseDiagId = "SYSLIB0012";
internal const string EscapeUriStringMessage = "Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.";
internal const string EscapeUriStringDiagId = "SYSLIB0013";
internal const string WebRequestMessage = "WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.";
internal const string WebRequestDiagId = "SYSLIB0014";
internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+.";
internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";
internal const string GetContextInfoMessage = "Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.";
internal const string GetContextInfoDiagId = "SYSLIB0016";
internal const string StrongNameKeyPairMessage = "Strong name signing is not supported and throws PlatformNotSupportedException.";
internal const string StrongNameKeyPairDiagId = "SYSLIB0017";
internal const string ReflectionOnlyLoadingMessage = "ReflectionOnly loading is not supported and throws PlatformNotSupportedException.";
internal const string ReflectionOnlyLoadingDiagId = "SYSLIB0018";
internal const string RuntimeEnvironmentMessage = "RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.";
internal const string RuntimeEnvironmentDiagId = "SYSLIB0019";
internal const string JsonSerializerOptionsIgnoreNullValuesMessage = "JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.";
internal const string JsonSerializerOptionsIgnoreNullValuesDiagId = "SYSLIB0020";
internal const string DerivedCryptographicTypesMessage = "Derived cryptographic types are obsolete. Use the Create method on the base type instead.";
internal const string DerivedCryptographicTypesDiagId = "SYSLIB0021";
internal const string RijndaelMessage = "The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.";
internal const string RijndaelDiagId = "SYSLIB0022";
internal const string RNGCryptoServiceProviderMessage = "RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.";
internal const string RNGCryptoServiceProviderDiagId = "SYSLIB0023";
internal const string AppDomainCreateUnloadMessage = "Creating and unloading AppDomains is not supported and throws an exception.";
internal const string AppDomainCreateUnloadDiagId = "SYSLIB0024";
internal const string SuppressIldasmAttributeMessage = "SuppressIldasmAttribute has no effect in .NET 6.0+.";
internal const string SuppressIldasmAttributeDiagId = "SYSLIB0025";
internal const string X509CertificateImmutableMessage = "X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.";
internal const string X509CertificateImmutableDiagId = "SYSLIB0026";
internal const string PublicKeyPropertyMessage = "PublicKey.Key is obsolete. Use the appropriate method to get the public key, such as GetRSAPublicKey.";
internal const string PublicKeyPropertyDiagId = "SYSLIB0027";
internal const string X509CertificatePrivateKeyMessage = "X509Certificate2.PrivateKey is obsolete. Use the appropriate method to get the private key, such as GetRSAPrivateKey, or use the CopyWithPrivateKey method to create a new instance with a private key.";
internal const string X509CertificatePrivateKeyDiagId = "SYSLIB0028";
internal const string ProduceLegacyHmacValuesMessage = "ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.";
internal const string ProduceLegacyHmacValuesDiagId = "SYSLIB0029";
internal const string UseManagedSha1Message = "HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.";
internal const string UseManagedSha1DiagId = "SYSLIB0030";
internal const string CryptoConfigEncodeOIDMessage = "EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.";
internal const string CryptoConfigEncodeOIDDiagId = "SYSLIB0031";
internal const string CorruptedStateRecoveryMessage = "Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.";
internal const string CorruptedStateRecoveryDiagId = "SYSLIB0032";
internal const string Rfc2898CryptDeriveKeyMessage = "Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.";
internal const string Rfc2898CryptDeriveKeyDiagId = "SYSLIB0033";
internal const string CmsSignerCspParamsCtorMessage = "CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.";
internal const string CmsSignerCspParamsCtorDiagId = "SYSLIB0034";
internal const string SignerInfoCounterSigMessage = "ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.";
internal const string SignerInfoCounterSigDiagId = "SYSLIB0035";
internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.";
internal const string RegexCompileToAssemblyDiagId = "SYSLIB0036";
internal const string AssemblyNameMembersMessage = "AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.";
internal const string AssemblyNameMembersDiagId = "SYSLIB0037";
internal const string SystemDataSerializationFormatBinaryMessage = "SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information.";
internal const string SystemDataSerializationFormatBinaryDiagId = "SYSLIB0038";
internal const string TlsVersion10and11Message = "TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults.";
internal const string TlsVersion10and11DiagId = "SYSLIB0039";
internal const string EncryptionPolicyMessage = "EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security and should not be used in production code.";
internal const string EncryptionPolicyDiagId = "SYSLIB0040";
internal const string EccXmlExportImportMessage = "ToXmlString and FromXmlString have no implementation for ECC types, and are obsolete. Use a standard import and export format such as ExportSubjectPublicKeyInfo or ImportSubjectPublicKeyInfo for public keys and ExportPkcs8PrivateKey or ImportPkcs8PrivateKey for private keys.";
internal const string EccXmlExportImportDiagId = "SYSLIB0042";
internal const string EcDhPublicKeyBlobMessage = "ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation on all platforms. Use ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo() instead.";
internal const string EcDhPublicKeyBlobDiagId = "SYSLIB0043";
internal const string AssemblyNameCodeBaseMessage = "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.";
internal const string AssemblyNameCodeBaseDiagId = "SYSLIB0044";
internal const string CryptoStringFactoryMessage = "Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.";
internal const string CryptoStringFactoryDiagId = "SYSLIB0045";
internal const string ControlledExecutionRunMessage = "ControlledExecution.Run method may corrupt the process and should not be used in production code.";
internal const string ControlledExecutionRunDiagId = "SYSLIB0046";
internal const string XmlSecureResolverMessage = "XmlSecureResolver is obsolete. Use XmlResolver.ThrowingResolver instead when attempting to forbid XML external entity resolution.";
internal const string XmlSecureResolverDiagId = "SYSLIB0047";
internal const string RsaEncryptDecryptValueMessage = "RSA.EncryptValue and DecryptValue are not supported and throw NotSupportedException. Use RSA.Encrypt and RSA.Decrypt instead.";
internal const string RsaEncryptDecryptDiagId = "SYSLIB0048";
internal const string JsonSerializerOptionsAddContextMessage = "JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties.";
internal const string JsonSerializerOptionsAddContextDiagId = "SYSLIB0049";
internal const string LegacyFormatterMessage = "Formatter-based serialization is obsolete and should not be used.";
internal const string LegacyFormatterDiagId = "SYSLIB0050";
internal const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
internal const string LegacyFormatterImplDiagId = "SYSLIB0051";
internal const string RegexExtensibilityImplMessage = "This API supports obsolete mechanisms for Regex extensibility. It is not supported.";
internal const string RegexExtensibilityDiagId = "SYSLIB0052";
internal const string AesGcmTagConstructorMessage = "AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.";
internal const string AesGcmTagConstructorDiagId = "SYSLIB0053";
internal const string ThreadVolatileReadWriteMessage = "Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.";
internal const string ThreadVolatileReadWriteDiagId = "SYSLIB0054";
internal const string ArmIntrinsicPerformsUnsignedOperationMessage = "The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead.";
internal const string ArmIntrinsicPerformsUnsignedOperationDiagId = "SYSLIB0055";
internal const string LoadFromHashAlgorithmMessage = "LoadFrom with a custom AssemblyHashAlgorithm is obsolete. Use overloads without an AssemblyHashAlgorithm.";
internal const string LoadFromHashAlgorithmDiagId = "SYSLIB0056";
internal const string X509CtorCertDataObsoleteMessage = "Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.";
internal const string X509CtorCertDataObsoleteDiagId = "SYSLIB0057";
internal const string TlsCipherAlgorithmEnumsMessage = "KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead.";
internal const string TlsCipherAlgorithmEnumsDiagId = "SYSLIB0058";
internal const string SystemEventsEventsThreadShutdownMessage = "SystemEvents.EventsThreadShutdown callbacks are not run before the process exits. Use AppDomain.ProcessExit instead.";
internal const string SystemEventsEventsThreadShutdownDiagId = "SYSLIB0059";
internal const string Rfc2898DeriveBytesCtorMessage = "The constructors on Rfc2898DeriveBytes are obsolete. Use the static Pbkdf2 method instead.";
internal const string Rfc2898DeriveBytesCtorDiagId = "SYSLIB0060";
internal const string QueryableMinByMaxByTSourceObsoleteMessage = "The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.";
internal const string QueryableMinByMaxByTSourceObsoleteDiagId = "SYSLIB0061";
internal const string XsltSettingsEnableScriptMessage = "XSLT Script blocks are not supported.";
internal const string XsltSettingsEnableScriptDiagId = "SYSLIB0062";
}
internal static class ThrowHelper
{
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException()
{
throw new ArgumentOutOfRangeException();
}
[DoesNotReturn]
internal static void ThrowArgumentException_DestinationTooShort()
{
throw new ArgumentException(System.SR.Argument_DestinationTooShort, "destination");
}
[DoesNotReturn]
internal static void ThrowArgumentException_CannotExtractScalar(System.ExceptionArgument argument)
{
throw GetArgumentException(System.ExceptionResource.Argument_CannotExtractScalar, argument);
}
[DoesNotReturn]
internal static void ThrowArgumentOutOfRange_IndexMustBeLessException()
{
throw GetArgumentOutOfRangeException(System.ExceptionArgument.index, System.ExceptionResource.ArgumentOutOfRange_IndexMustBeLess);
}
[DoesNotReturn]
internal static void ThrowArgumentNullException(System.ExceptionArgument argument)
{
throw new ArgumentNullException(GetArgumentName(argument));
}
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
{
throw new ArgumentOutOfRangeException(GetArgumentName(argument));
}
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(System.ExceptionArgument argument, System.ExceptionResource resource)
{
return new ArgumentOutOfRangeException(GetArgumentName(argument), GetResourceString(resource));
}
private static ArgumentException GetArgumentException(System.ExceptionResource resource, System.ExceptionArgument argument)
{
return new ArgumentException(GetResourceString(resource), GetArgumentName(argument));
}
private static string GetArgumentName(System.ExceptionArgument argument)
{
return argument switch
{
System.ExceptionArgument.ch => "ch",
System.ExceptionArgument.culture => "culture",
System.ExceptionArgument.index => "index",
System.ExceptionArgument.input => "input",
System.ExceptionArgument.value => "value",
_ => "",
};
}
private static string GetResourceString(System.ExceptionResource resource)
{
return resource switch
{
System.ExceptionResource.ArgumentOutOfRange_IndexMustBeLess => System.SR.ArgumentOutOfRange_IndexMustBeLess,
System.ExceptionResource.Argument_CannotExtractScalar => System.SR.Argument_CannotExtractScalar,
_ => "",
};
}
}
internal enum ExceptionArgument
{
ch,
culture,
index,
input,
value
}
internal enum ExceptionResource
{
Argument_CannotExtractScalar,
ArgumentOutOfRange_IndexMustBeLess
}
internal static class Marvin
{
public static ulong DefaultSeed { get; } = GenerateSeed();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed)
{
return ComputeHash32(ref MemoryMarshal.GetReference(data), (uint)data.Length, (uint)seed, (uint)(seed >> 32));
}
public static int ComputeHash32(ref byte data, uint count, uint p0, uint p1)
{
uint num;
if (count < 8)
{
if (count < 4)
{
num = ((!BitConverter.IsLittleEndian) ? 2147483648u : 128u);
if ((count & (true ? 1u : 0u)) != 0)
{
num = Unsafe.AddByteOffset(ref data, (nuint)count & (nuint)2u);
if (BitConverter.IsLittleEndian)
{
num |= 0x8000u;
}
else
{
num <<= 24;
num |= 0x800000u;
}
}
if ((count & 2u) != 0)
{
if (BitConverter.IsLittleEndian)
{
num <<= 16;
num |= Unsafe.ReadUnaligned<ushort>(ref data);
}
else
{
num |= Unsafe.ReadUnaligned<ushort>(ref data);
num = RotateLeft(num, 16);
}
}
goto IL_00bd;
}
}
else
{
uint num2 = count / 8;
do
{
p0 += Unsafe.ReadUnaligned<uint>(ref data);
uint num3 = Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, 4u));
Block(ref p0, ref p1);
p0 += num3;
Block(ref p0, ref p1);
data = ref Unsafe.AddByteOffset(ref data, 8u);
}
while (--num2 != 0);
if ((count & 4) == 0)
{
goto IL_006a;
}
}
p0 += Unsafe.ReadUnaligned<uint>(ref data);
Block(ref p0, ref p1);
goto IL_006a;
IL_006a:
num = Unsafe.ReadUnaligned<uint>(ref Unsafe.Add(ref Unsafe.AddByteOffset(ref data, (nuint)count & (nuint)7u), -4));
count = ~count << 3;
if (BitConverter.IsLittleEndian)
{
num >>= 8;
num |= 0x80000000u;
num >>= (int)(count & 0x1F);
}
else
{
num <<= 8;
num |= 0x80u;
num <<= (int)(count & 0x1F);
}
goto IL_00bd;
IL_00bd:
p0 += num;
Block(ref p0, ref p1);
Block(ref p0, ref p1);
return (int)(p1 ^ p0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Block(ref uint rp0, ref uint rp1)
{
uint num = rp0;
uint num2 = rp1;
num2 ^= num;
num = RotateLeft(num, 20);
num += num2;
num2 = RotateLeft(num2, 9);
num2 ^= num;
num = RotateLeft(num, 27);
num += num2;
num2 = RotateLeft(num2, 19);
rp0 = num;
rp1 = num2;
}
private unsafe static ulong GenerateSeed()
{
byte[] array = new byte[8];
using RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
randomNumberGenerator.GetBytes(array);
fixed (byte* ptr = array)
{
return *(ulong*)ptr;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static uint RotateLeft(uint value, int shift)
{
return (value << shift) | (value >> 32 - shift);
}
}
internal static class SR
{
private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();
private static ResourceManager s_resourceManager;
internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));
internal static string ArrayDepthTooLarge => GetResourceString("ArrayDepthTooLarge");
internal static string CallFlushToAvoidDataLoss => GetResourceString("CallFlushToAvoidDataLoss");
internal static string CannotReadIncompleteUTF16 => GetResourceString("CannotReadIncompleteUTF16");
internal static string CannotReadInvalidUTF16 => GetResourceString("CannotReadInvalidUTF16");
internal static string CannotStartObjectArrayAfterPrimitiveOrClose => GetResourceString("CannotStartObjectArrayAfterPrimitiveOrClose");
internal static string CannotStartObjectArrayWithoutProperty => GetResourceString("CannotStartObjectArrayWithoutProperty");
internal static string CannotTranscodeInvalidUtf8 => GetResourceString("CannotTranscodeInvalidUtf8");
internal static string CannotDecodeInvalidBase64 => GetResourceString("CannotDecodeInvalidBase64");
internal static string CannotTranscodeInvalidUtf16 => GetResourceString("CannotTranscodeInvalidUtf16");
internal static string CannotEncodeInvalidUTF16 => GetResourceString("CannotEncodeInvalidUTF16");
internal static string CannotEncodeInvalidUTF8 => GetResourceString("CannotEncodeInvalidUTF8");
internal static string CannotWritePropertyWithinArray => GetResourceString("CannotWritePropertyWithinArray");
internal static string CannotWritePropertyAfterProperty => GetResourceString("CannotWritePropertyAfterProperty");
internal static string CannotWriteValueAfterPrimitiveOrClose => GetResourceString("CannotWriteValueAfterPrimitiveOrClose");
internal static string CannotWriteValueWithinObject => GetResourceString("CannotWriteValueWithinObject");
internal static string DepthTooLarge => GetResourceString("DepthTooLarge");
internal static string DestinationTooShort => GetResourceString("DestinationTooShort");
internal static string EmptyJsonIsInvalid => GetResourceString("EmptyJsonIsInvalid");
internal static string EndOfCommentNotFound => GetResourceString("EndOfCommentNotFound");
internal static string EndOfStringNotFound => GetResourceString("EndOfStringNotFound");
internal static string ExpectedEndAfterSingleJson => GetResourceString("ExpectedEndAfterSingleJson");
internal static string ExpectedEndOfDigitNotFound => GetResourceString("ExpectedEndOfDigitNotFound");
internal static string ExpectedFalse => GetResourceString("ExpectedFalse");
internal static string ExpectedJsonTokens => GetResourceString("ExpectedJsonTokens");
internal static string ExpectedOneCompleteToken => GetResourceString("ExpectedOneCompleteToken");
internal static string ExpectedNextDigitEValueNotFound => GetResourceString("ExpectedNextDigitEValueNotFound");
internal static string ExpectedNull => GetResourceString("ExpectedNull");
internal static string ExpectedSeparatorAfterPropertyNameNotFound => GetResourceString("ExpectedSeparatorAfterPropertyNameNotFound");
internal static string ExpectedStartOfPropertyNotFound => GetResourceString("ExpectedStartOfPropertyNotFound");
internal static string ExpectedStartOfPropertyOrValueNotFound => GetResourceString("ExpectedStartOfPropertyOrValueNotFound");
internal static string ExpectedStartOfValueNotFound => GetResourceString("ExpectedStartOfValueNotFound");
internal static string ExpectedTrue => GetResourceString("ExpectedTrue");
internal static string ExpectedValueAfterPropertyNameNotFound => GetResourceString("ExpectedValueAfterPropertyNameNotFound");
internal static string FailedToGetLargerSpan => GetResourceString("FailedToGetLargerSpan");
internal static string FoundInvalidCharacter => GetResourceString("FoundInvalidCharacter");
internal static string InvalidCast => GetResourceString("InvalidCast");
internal static string InvalidCharacterAfterEscapeWithinString => GetResourceString("InvalidCharacterAfterEscapeWithinString");
internal static string InvalidCharacterWithinString => GetResourceString("InvalidCharacterWithinString");
internal static string UnsupportedEnumIdentifier => GetResourceString("UnsupportedEnumIdentifier");
internal static string InvalidEndOfJsonNonPrimitive => GetResourceString("InvalidEndOfJsonNonPrimitive");
internal static string InvalidHexCharacterWithinString => GetResourceString("InvalidHexCharacterWithinString");
internal static string JsonDocumentDoesNotSupportComments => GetResourceString("JsonDocumentDoesNotSupportComments");
internal static string JsonElementHasWrongType => GetResourceString("JsonElementHasWrongType");
internal static string JsonElementDeepEqualsInsufficientExecutionStack => GetResourceString("JsonElementDeepEqualsInsufficientExecutionStack");
internal static string JsonNumberExponentTooLarge => GetResourceString("JsonNumberExponentTooLarge");
internal static string DefaultTypeInfoResolverImmutable => GetResourceString("DefaultTypeInfoResolverImmutable");
internal static string TypeInfoResolverChainImmutable => GetResourceString("TypeInfoResolverChainImmutable");
internal static string TypeInfoImmutable => GetResourceString("TypeInfoImmutable");
internal static string MaxDepthMustBePositive => GetResourceString("MaxDepthMustBePositive");
internal static string CommentHandlingMustBeValid => GetResourceString("CommentHandlingMustBeValid");
internal static string MismatchedObjectArray => GetResourceString("MismatchedObjectArray");
internal static string CannotWriteEndAfterProperty => GetResourceString("CannotWriteEndAfterProperty");
internal static string ObjectDepthTooLarge => GetResourceString("ObjectDepthTooLarge");
internal static string PropertyNameTooLarge => GetResourceString("PropertyNameTooLarge");
internal static string FormatDecimal => GetResourceString("FormatDecimal");
internal static string FormatDouble => GetResourceString("FormatDouble");
internal static string FormatInt32 => GetResourceString("FormatInt32");
internal static string FormatInt64 => GetResourceString("FormatInt64");
internal static string FormatSingle => GetResourceString("FormatSingle");
internal static string FormatUInt32 => GetResourceString("FormatUInt32");
internal static string FormatUInt64 => GetResourceString("FormatUInt64");
internal static string RequiredDigitNotFoundAfterDecimal => GetResourceString("RequiredDigitNotFoundAfterDecimal");
internal static string RequiredDigitNotFoundAfterSign => GetResourceString("RequiredDigitNotFoundAfterSign");
internal static string RequiredDigitNotFoundEndOfData => GetResourceString("RequiredDigitNotFoundEndOfData");
internal static string SpecialNumberValuesNotSupported => GetResourceString("SpecialNumberValuesNotSupported");
internal static string ValueTooLarge => GetResourceString("ValueTooLarge");
internal static string ZeroDepthAtEnd => GetResourceString("ZeroDepthAtEnd");
internal static string DeserializeUnableToConvertValue => GetResourceString("DeserializeUnableToConvertValue");
internal static string DeserializeWrongType => GetResourceString("DeserializeWrongType");
internal static string SerializationInvalidBufferSize => GetResourceString("SerializationInvalidBufferSize");
internal static string BufferWriterAdvancedTooFar => GetResourceString("BufferWriterAdvancedTooFar");
internal static string InvalidComparison => GetResourceString("InvalidComparison");
internal static string UnsupportedFormat => GetResourceString("UnsupportedFormat");
internal static string ExpectedStartOfPropertyOrValueAfterComment => GetResourceString("ExpectedStartOfPropertyOrValueAfterComment");
internal static string TrailingCommaNotAllowedBeforeArrayEnd => GetResourceString("TrailingCommaNotAllowedBeforeArrayEnd");
internal static string TrailingCommaNotAllowedBeforeObjectEnd => GetResourceString("TrailingCommaNotAllowedBeforeObjectEnd");
internal static string SerializerOptionsReadOnly => GetResourceString("SerializerOptionsReadOnly");
internal static string SerializerOptions_InvalidChainedResolver => GetResourceString("SerializerOptions_InvalidChainedResolver");
internal static string StreamNotWritable => GetResourceString("StreamNotWritable");
internal static string CannotWriteCommentWithEmbeddedDelimiter => GetResourceString("CannotWriteCommentWithEmbeddedDelimiter");
internal static string SerializerPropertyNameConflict => GetResourceString("SerializerPropertyNameConflict");
internal static string SerializerPropertyNameNull => GetResourceString("SerializerPropertyNameNull");
internal static string SerializationDataExtensionPropertyInvalid => GetResourceString("SerializationDataExtensionPropertyInvalid");
internal static string PropertyTypeNotNullable => GetResourceString("PropertyTypeNotNullable");
internal static string SerializationDuplicateTypeAttribute => GetResourceString("SerializationDuplicateTypeAttribute");
internal static string ExtensionDataConflictsWithUnmappedMemberHandling => GetResourceString("ExtensionDataConflictsWithUnmappedMemberHandling");
internal static string SerializationNotSupportedType => GetResourceString("SerializationNotSupportedType");
internal static string TypeRequiresAsyncSerialization => GetResourceString("TypeRequiresAsyncSerialization");
internal static string InvalidCharacterAtStartOfComment => GetResourceString("InvalidCharacterAtStartOfComment");
internal static string UnexpectedEndOfDataWhileReadingComment => GetResourceString("UnexpectedEndOfDataWhileReadingComment");
internal static string CannotSkip => GetResourceString("CannotSkip");
internal static string NotEnoughData => GetResourceString("NotEnoughData");
internal static string UnexpectedEndOfLineSeparator => GetResourceString("UnexpectedEndOfLineSeparator");
internal static string JsonSerializerDoesNotSupportComments => GetResourceString("JsonSerializerDoesNotSupportComments");
internal static string DeserializeNoConstructor => GetResourceString("DeserializeNoConstructor");
internal static string DeserializeInterfaceOrAbstractType => GetResourceString("DeserializeInterfaceOrAbstractType");
internal static string DeserializationMustSpecifyTypeDiscriminator => GetResourceString("DeserializationMustSpecifyTypeDiscriminator");
internal static string SerializationConverterOnAttributeNotCompatible => GetResourceString("SerializationConverterOnAttributeNotCompatible");
internal static string SerializationConverterOnAttributeInvalid => GetResourceString("SerializationConverterOnAttributeInvalid");
internal static string SerializationConverterRead => GetResourceString("SerializationConverterRead");
internal static string SerializationConverterNotCompatible => GetResourceString("SerializationConverterNotCompatible");
internal static string ResolverTypeNotCompatible => GetResourceString("ResolverTypeNotCompatible");
internal static string ResolverTypeInfoOptionsNotCompatible => GetResourceString("ResolverTypeInfoOptionsNotCompatible");
internal static string SerializationConverterWrite => GetResourceString("SerializationConverterWrite");
internal static string NamingPolicyReturnNull => GetResourceString("NamingPolicyReturnNull");
internal static string SerializationDuplicateAttribute => GetResourceString("SerializationDuplicateAttribute");
internal static string SerializeUnableToSerialize => GetResourceString("SerializeUnableToSerialize");
internal static string FormatByte => GetResourceString("FormatByte");
internal static string FormatInt16 => GetResourceString("FormatInt16");
internal static string FormatSByte => GetResourceString("FormatSByte");
internal static string FormatUInt16 => GetResourceString("FormatUInt16");
internal static string SerializerCycleDetected => GetResourceString("SerializerCycleDetected");
internal static string InvalidLeadingZeroInNumber => GetResourceString("InvalidLeadingZeroInNumber");
internal static string MetadataCannotParsePreservedObjectToImmutable => GetResourceString("MetadataCannotParsePreservedObjectToImmutable");
internal static string MetadataDuplicateIdFound => GetResourceString("MetadataDuplicateIdFound");
internal static string MetadataIdCannotBeCombinedWithRef => GetResourceString("MetadataIdCannotBeCombinedWithRef");
internal static string MetadataInvalidReferenceToValueType => GetResourceString("MetadataInvalidReferenceToValueType");
internal static string MetadataInvalidTokenAfterValues => GetResourceString("MetadataInvalidTokenAfterValues");
internal static string MetadataPreservedArrayFailed => GetResourceString("MetadataPreservedArrayFailed");
internal static string MetadataInvalidPropertyInArrayMetadata => GetResourceString("MetadataInvalidPropertyInArrayMetadata");
internal static string MetadataStandaloneValuesProperty => GetResourceString("MetadataStandaloneValuesProperty");
internal static string MetadataReferenceCannotContainOtherProperties => GetResourceString("MetadataReferenceCannotContainOtherProperties");
internal static string MetadataReferenceNotFound => GetResourceString("MetadataReferenceNotFound");
internal static string MetadataValueWasNotString => GetResourceString("MetadataValueWasNotString");
internal static string MetadataInvalidPropertyWithLeadingDollarSign => GetResourceString("MetadataInvalidPropertyWithLeadingDollarSign");
internal static string MetadataUnexpectedProperty => GetResourceString("MetadataUnexpectedProperty");
internal static string UnmappedJsonProperty => GetResourceString("UnmappedJsonProperty");
internal static string DuplicateMetadataProperty => GetResourceString("DuplicateMetadataProperty");
internal static string MultipleMembersBindWithConstructorParameter => GetResourceString("MultipleMembersBindWithConstructorParameter");
internal static string ConstructorParamIncompleteBinding => GetResourceString("ConstructorParamIncompleteBinding");
internal static string ObjectWithParameterizedCtorRefMetadataNotSupported => GetResourceString("ObjectWithParameterizedCtorRefMetadataNotSupported");
internal static string SerializerConverterFactoryReturnsNull => GetResourceString("SerializerConverterFactoryReturnsNull");
internal static string SerializationNotSupportedParentType => GetResourceString("SerializationNotSupportedParentType");
internal static string ExtensionDataCannotBindToCtorParam => GetResourceString("ExtensionDataCannotBindToCtorParam");
internal static string BufferMaximumSizeExceeded => GetResourceString("BufferMaximumSizeExceeded");
internal static string CannotSerializeInvalidType => GetResourceString("CannotSerializeInvalidType");
internal static string SerializeTypeInstanceNotSupported => GetResourceString("SerializeTypeInstanceNotSupported");
internal static string JsonIncludeOnInaccessibleProperty => GetResourceString("JsonIncludeOnInaccessibleProperty");
internal static string CannotSerializeInvalidMember => GetResourceString("CannotSerializeInvalidMember");
internal static string CannotPopulateCollection => GetResourceString("CannotPopulateCollection");
internal static string ConstructorContainsNullParameterNames => GetResourceString("ConstructorContainsNullParameterNames");
internal static string DefaultIgnoreConditionAlreadySpecified => GetResourceString("DefaultIgnoreConditionAlreadySpecified");
internal static string DefaultIgnoreConditionInvalid => GetResourceString("DefaultIgnoreConditionInvalid");
internal static string DictionaryKeyTypeNotSupported => GetResourceString("DictionaryKeyTypeNotSupported");
internal static string IgnoreConditionOnValueTypeInvalid => GetResourceString("IgnoreConditionOnValueTypeInvalid");
internal static string NumberHandlingOnPropertyInvalid => GetResourceString("NumberHandlingOnPropertyInvalid");
internal static string ConverterCanConvertMultipleTypes => GetResourceString("ConverterCanConvertMultipleTypes");
internal static string MetadataReferenceOfTypeCannotBeAssignedToType => GetResourceString("MetadataReferenceOfTypeCannotBeAssignedToType");
internal static string DeserializeUnableToAssignValue => GetResourceString("DeserializeUnableToAssignValue");
internal static string DeserializeUnableToAssignNull => GetResourceString("DeserializeUnableToAssignNull");
internal static string SerializerConverterFactoryReturnsJsonConverterFactory => GetResourceString("SerializerConverterFactoryReturnsJsonConverterFactory");
internal static string SerializerConverterFactoryInvalidArgument => GetResourceString("SerializerConverterFactoryInvalidArgument");
internal static string NodeElementWrongType => GetResourceString("NodeElementWrongType");
internal static string NodeElementCannotBeObjectOrArray => GetResourceString("NodeElementCannotBeObjectOrArray");
internal static string NodeAlreadyHasParent => GetResourceString("NodeAlreadyHasParent");
internal static string NodeCycleDetected => GetResourceString("NodeCycleDetected");
internal static string NodeUnableToConvert => GetResourceString("NodeUnableToConvert");
internal static string NodeUnableToConvertElement => GetResourceString("NodeUnableToConvertElement");
internal static string NodeValueNotAllowed => GetResourceString("NodeValueNotAllowed");
internal static string NodeWrongType => GetResourceString("NodeWrongType");
internal static string NodeParentWrongType => GetResourceString("NodeParentWrongType");
internal static string NodeDuplicateKey => GetResourceString("NodeDuplicateKey");
internal static string SerializerContextOptionsReadOnly => GetResourceString("SerializerContextOptionsReadOnly");
internal static string ConverterForPropertyMustBeValid => GetResourceString("ConverterForPropertyMustBeValid");
internal static string NoMetadataForType => GetResourceString("NoMetadataForType");
internal static string AmbiguousMetadataForType => GetResourceString("AmbiguousMetadataForType");
internal static string CollectionIsReadOnly => GetResourceString("CollectionIsReadOnly");
internal static string ArrayIndexNegative => GetResourceString("ArrayIndexNegative");
internal static string ArrayTooSmall => GetResourceString("ArrayTooSmall");
internal static string NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty => GetResourceString("NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty");
internal static string NoMetadataForTypeProperties => GetResourceString("NoMetadataForTypeProperties");
internal static string FieldCannotBeVirtual => GetResourceString("FieldCannotBeVirtual");
internal static string MissingFSharpCoreMember => GetResourceString("MissingFSharpCoreMember");
internal static string FSharpDiscriminatedUnionsNotSupported => GetResourceString("FSharpDiscriminatedUnionsNotSupported");
internal static string Polymorphism_BaseConverterDoesNotSupportMetadata => GetResourceString("Polymorphism_BaseConverterDoesNotSupportMetadata");
internal static string Polymorphism_DerivedConverterDoesNotSupportMetadata => GetResourceString("Polymorphism_DerivedConverterDoesNotSupportMetadata");
internal static string Polymorphism_TypeDoesNotSupportPolymorphism => GetResourceString("Polymorphism_TypeDoesNotSupportPolymorphism");
internal static string Polymorphism_DerivedTypeIsNotSupported => GetResourceString("Polymorphism_DerivedTypeIsNotSupported");
internal static string Polymorphism_DerivedTypeIsAlreadySpecified => GetResourceString("Polymorphism_DerivedTypeIsAlreadySpecified");
internal static string Polymorphism_TypeDicriminatorIdIsAlreadySpecified => GetResourceString("Polymorphism_TypeDicriminatorIdIsAlreadySpecified");
internal static string Polymorphism_InvalidCustomTypeDiscriminatorPropertyName => GetResourceString("Polymorphism_InvalidCustomTypeDiscriminatorPropertyName");
internal static string Polymorphism_PropertyConflictsWithMetadataPropertyName => GetResourceString("Polymorphism_PropertyConflictsWithMetadataPropertyName");
internal static string Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes => GetResourceString("Polymorphism_ConfigurationDoesNotSpecifyDerivedTypes");
internal static string Polymorphism_UnrecognizedTypeDiscriminator => GetResourceString("Polymorphism_UnrecognizedTypeDiscriminator");
internal static string Polymorphism_RuntimeTypeNotSupported => GetResourceString("Polymorphism_RuntimeTypeNotSupported");
internal static string Polymorphism_RuntimeTypeDiamondAmbiguity => GetResourceString("Polymorphism_RuntimeTypeDiamondAmbiguity");
internal static string InvalidJsonTypeInfoOperationForKind => GetResourceString("InvalidJsonTypeInfoOperationForKind");
internal static string OnDeserializingCallbacksNotSupported => GetResourceString("OnDeserializingCallbacksNotSupported");
internal static string CreateObjectConverterNotCompatible => GetResourceString("CreateObjectConverterNotCompatible");
internal static string JsonPropertyInfoBoundToDifferentParent => GetResourceString("JsonPropertyInfoBoundToDifferentParent");
internal static string JsonSerializerOptionsNoTypeInfoResolverSpecified => GetResourceString("JsonSerializerOptionsNoTypeInfoResolverSpecified");
internal static string JsonSerializerIsReflectionDisabled => GetResourceString("JsonSerializerIsReflectionDisabled");
internal static string JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo => GetResourceString("JsonPolymorphismOptionsAssociatedWithDifferentJsonTypeInfo");
internal static string JsonPropertyRequiredAndNotDeserializable => GetResourceString("JsonPropertyRequiredAndNotDeserializable");
internal static string JsonPropertyRequiredAndExtensionData => GetResourceString("JsonPropertyRequiredAndExtensionData");
internal static string JsonRequiredPropertiesMissing => GetResourceString("JsonRequiredPropertiesMissing");
internal static string ObjectCreationHandlingPopulateNotSupportedByConverter => GetResourceString("ObjectCreationHandlingPopulateNotSupportedByConverter");
internal static string ObjectCreationHandlingPropertyMustHaveAGetter => GetResourceString("ObjectCreationHandlingPropertyMustHaveAGetter");
internal static string ObjectCreationHandlingPropertyValueTypeMustHaveASetter => GetResourceString("ObjectCreationHandlingPropertyValueTypeMustHaveASetter");
internal static string ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserialization => GetResourceString("ObjectCreationHandlingPropertyCannotAllowPolymorphicDeserialization");
internal static string ObjectCreationHandlingPropertyCannotAllowReadOnlyMember => GetResourceString("ObjectCreationHandlingPropertyCannotAllowReadOnlyMember");
internal static string ObjectCreationHandlingPropertyCannotAllowReferenceHandling => GetResourceString("ObjectCreationHandlingPropertyCannotAllowReferenceHandling");
internal static string ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors => GetResourceString("ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors");
internal static string FormatInt128 => GetResourceString("FormatInt128");
internal static string FormatUInt128 => GetResourceString("FormatUInt128");
internal static string FormatHalf => GetResourceString("FormatHalf");
internal static string InvalidIndentCharacter => GetResourceString("InvalidIndentCharacter");
internal static string InvalidIndentSize => GetResourceString("InvalidIndentSize");
internal static string PipeWriterCanceled => GetResourceString("PipeWriterCanceled");
internal static string PipeWriter_DoesNotImplementUnflushedBytes => GetResourceString("PipeWriter_DoesNotImplementUnflushedBytes");
internal static string InvalidNewLine => GetResourceString("InvalidNewLine");
internal static string PropertyGetterDisallowNull => GetResourceString("PropertyGetterDisallowNull");
internal static string PropertySetterDisallowNull => GetResourceString("PropertySetterDisallowNull");
internal static string ConstructorParameterDisallowNull => GetResourceString("ConstructorParameterDisallowNull");
internal static string JsonSchemaExporter_ReferenceHandlerPreserve_NotSupported => GetResourceString("JsonSchemaExporter_ReferenceHandlerPreserve_NotSupported");
internal static string JsonSchemaExporter_DepthTooLarge => GetResourceString("JsonSchemaExporter_DepthTooLarge");
internal static string Arg_WrongType => GetResourceString("Arg_WrongType");
internal static string Arg_ArrayPlusOffTooSmall => GetResourceString("Arg_ArrayPlusOffTooSmall");
internal static string Arg_RankMultiDimNotSupported => GetResourceString("Arg_RankMultiDimNotSupported");
internal static string Arg_NonZeroLowerBound => GetResourceString("Arg_NonZeroLowerBound");
internal static string Argument_IncompatibleArrayType => GetResourceString("Argument_IncompatibleArrayType");
internal static string Arg_KeyNotFoundWithKey => GetResourceString("Arg_KeyNotFoundWithKey");
internal static string Argument_AddingDuplicate => GetResourceString("Argument_AddingDuplicate");
internal static string InvalidOperation_ConcurrentOperationsNotSupported => GetResourceString("InvalidOperation_ConcurrentOperationsNotSupported");
internal static string InvalidOperation_EnumFailedVersion => GetResourceString("InvalidOperation_EnumFailedVersion");
internal static string ArgumentOutOfRange_Generic_MustBeNonNegative => GetResourceString("ArgumentOutOfRange_Generic_MustBeNonNegative");
internal static string ArgumentOutOfRange_Generic_MustBeGreaterOrEqual => GetResourceString("ArgumentOutOfRange_Generic_MustBeGreaterOrEqual");
internal static string ArgumentOutOfRange_Generic_MustBeLessOrEqual => GetResourceString("ArgumentOutOfRange_Generic_MustBeLessOrEqual");
internal static string Arg_HTCapacityOverflow => GetResourceString("Arg_HTCapacityOverflow");
internal static string Argument_InvalidOffLen => GetResourceString("Argument_InvalidOffLen");
internal static string CannotWriteWithinString => GetResourceString("CannotWriteWithinString");
internal static string Arg_MustBeRune => GetResourceString("Arg_MustBeRune");
internal static string ArgumentOutOfRange_IndexMustBeLess => GetResourceString("ArgumentOutOfRange_IndexMustBeLess");
internal static string Argument_DestinationTooShort => GetResourceString("Argument_DestinationTooShort");
internal static string Argument_CannotExtractScalar => GetResourceString("Argument_CannotExtractScalar");
internal static string CannotMixEncodings => GetResourceString("CannotMixEncodings");
internal static string DuplicatePropertiesNotAllowed_JsonPropertyInfo => GetResourceString("DuplicatePropertiesNotAllowed_JsonPropertyInfo");
internal static string DuplicatePropertiesNotAllowed_NameSpan => GetResourceString("DuplicatePropertiesNotAllowed_NameSpan");
internal static string DuplicatePropertiesNotAllowed => GetResourceString("DuplicatePropertiesNotAllowed");
internal static string PipeReaderCanceled => GetResourceString("PipeReaderCanceled");
private static bool GetUsingResourceKeysSwitchValue()
{
if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
{
return false;
}
return isEnabled;
}
internal static bool UsingResourceKeys()
{
return s_usingResourceKeys;
}
private static string GetResourceString(string resourceKey)
{
if (UsingResourceKeys())
{
return resourceKey;
}
string result = null;
try
{
result = ResourceManager.GetString(resourceKey);
}
catch (MissingManifestResourceException)
{
}
return result;
}
private static string GetResourceString(string resourceKey, string defaultString)
{
string resourceString = GetResourceString(resourceKey);
if (!(resourceKey == resourceString) && resourceString != null)
{
return resourceString;
}
return defaultString;
}
internal static string Format(string resourceFormat, object p1)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1);
}
return string.Format(resourceFormat, p1);
}
internal static string Format(string resourceFormat, object p1, object p2)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2);
}
return string.Format(resourceFormat, p1, p2);
}
internal static string Format(string resourceFormat, object p1, object p2, object p3)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2, p3);
}
return string.Format(resourceFormat, p1, p2, p3);
}
internal static string Format(string resourceFormat, params object[] args)
{
if (args != null)
{
if (UsingResourceKeys())
{
return resourceFormat + ", " + string.Join(", ", args);
}
return string.Format(resourceFormat, args);
}
return resourceFormat;
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1);
}
return string.Format(provider, resourceFormat, p1);
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2);
}
return string.Format(provider, resourceFormat, p1, p2);
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2, p3);
}
return string.Format(provider, resourceFormat, p1, p2, p3);
}
internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
{
if (args != null)
{
if (UsingResourceKeys())
{
return resourceFormat + ", " + string.Join(", ", args);
}
return string.Format(provider, resourceFormat, args);
}
return resourceFormat;
}
}
internal static class ExceptionPolyfills
{
[SpecialName]
public sealed class <G>$E6188BA5B951F1F7AA9135E0EBB76F2B
{
[SpecialName]
public static class <M>$96F0261AC622664B8B003966835C0332
{
}
[ExtensionMarker("<M>$96F0261AC622664B8B003966835C0332")]
public static void ThrowIfNull([NotNull] object argument, [CallerArgumentExpression("argument")] string paramName = null)
{
throw null;
}
}
[SpecialName]
public sealed class <G>$3F30F31B33543D5FB8E174FB4FD780B9
{
[SpecialName]
public static class <M>$1F10CFA08738E6D8AF61CBECC6763DBC
{
}
[ExtensionMarker("<M>$1F10CFA08738E6D8AF61CBECC6763DBC")]
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, object instance)
{
throw null;
}
[ExtensionMarker("<M>$1F10CFA08738E6D8AF61CBECC6763DBC")]
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, Type type)
{
throw null;
}
}
public static void ThrowIfNull([NotNull] object argument, [CallerArgumentExpression("argument")] string paramName = null)
{
if (argument == null)
{
ThrowArgumentNullException(paramName);
}
}
[DoesNotReturn]
private static void ThrowArgumentNullException(string paramName)
{
throw new ArgumentNullException(paramName);
}
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, object instance)
{
if (condition)
{
ThrowObjectDisposedException(instance);
}
}
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, Type type)
{
if (condition)
{
ThrowObjectDisposedException(type);
}
}
[DoesNotReturn]
private static void ThrowObjectDisposedException(object instance)
{
throw new ObjectDisposedException(instance?.GetType().FullName);
}
[DoesNotReturn]
private static void ThrowObjectDisposedException(Type type)
{
throw new ObjectDisposedException(type?.FullName);
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
internal sealed class ObsoleteAttribute : Attribute
{
public string Message { get; }
public bool IsError { get; }
public string DiagnosticId { get; set; }
public string UrlFormat { get; set; }
public ObsoleteAttribute()
{
}
public ObsoleteAttribute(string message)
{
Message = message;
}
public ObsoleteAttribute(string message, bool error)
{
Message = message;
IsError = error;
}
}
}
namespace System.Buffers
{
internal sealed class ArrayBufferWriter<T> : IBufferWriter<T>
{
private const int ArrayMaxLength = 2147483591;
private const int DefaultInitialBufferSize = 256;
private T[] _buffer;
private int _index;
public ReadOnlyMemory<T> WrittenMemory => _buffer.AsMemory(0, _index);
public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, _index);
public int WrittenCount => _index;
public int Capacity => _buffer.Length;
public int FreeCapacity => _buffer.Length - _index;
public ArrayBufferWriter()
{
_buffer = Array.Empty<T>();
_index = 0;
}
public ArrayBufferWriter(int initialCapacity)
{
if (initialCapacity <= 0)
{
throw new ArgumentException(null, "initialCapacity");
}
_buffer = new T[initialCapacity];
_index = 0;
}
public void Clear()
{
_buffer.AsSpan(0, _index).Clear();
_index = 0;
}
public void ResetWrittenCount()
{
_index = 0;
}
public void Advance(int count)
{
if (count < 0)
{
throw new ArgumentException(null, "count");
}
if (_index > _buffer.Length - count)
{
ThrowInvalidOperationException_AdvancedTooFar(_buffer.Length);
}
_index += count;
}
public Memory<T> GetMemory(int sizeHint = 0)
{
CheckAndResizeBuffer(sizeHint);
return _buffer.AsMemory(_index);
}
public Span<T> GetSpan(int sizeHint = 0)
{
CheckAndResizeBuffer(sizeHint);
return _buffer.AsSpan(_index);
}
private void CheckAndResizeBuffer(int sizeHint)
{
if (sizeHint < 0)
{
throw new ArgumentException("sizeHint");
}
if (sizeHint == 0)
{
sizeHint = 1;
}
if (sizeHint <= FreeCapacity)
{
return;
}
int num = _buffer.Length;
int num2 = Math.Max(sizeHint, num);
if (num == 0)
{
num2 = Math.Max(num2, 256);
}
int num3 = num + num2;
if ((uint)num3 > 2147483647u)
{
uint num4 = (uint)(num - FreeCapacity + sizeHint);
if (num4 > 2147483591)
{
ThrowOutOfMemoryException(num4);
}
num3 = 2147483591;
}
Array.Resize(ref _buffer, num3);
}
private static void ThrowInvalidOperationException_AdvancedTooFar(int capacity)
{
throw new InvalidOperationException(System.SR.Format(System.SR.BufferWriterAdvancedTooFar, capacity));
}
private static void ThrowOutOfMemoryException(uint capacity)
{
throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
}
}
}
namespace System.IO
{
internal static class StreamExtensions
{
public static ValueTask<int> ReadAsync(this Stream stream, Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (MemoryMarshal.TryGetArray((ReadOnlyMemory<byte>)buffer, out ArraySegment<byte> segment))
{
return new ValueTask<int>(stream.ReadAsync(segment.Array, segment.Offset, segment.Count, cancellationToken));
}
byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length);
return FinishReadAsync(stream.ReadAsync(array, 0, buffer.Length, cancellationToken), array, buffer);
static async ValueTask<int> FinishReadAsync(Task<int> readTask, byte[] localBuffer, Memory<byte> localDestination)
{
try
{
int num = await readTask.ConfigureAwait(continueOnCapturedContext: false);
new Span<byte>(localBuffer, 0, num).CopyTo(localDestination.Span);
return num;
}
finally
{
ArrayPool<byte>.Shared.Return(localBuffer);
}
}
}
public static void Write(this Stream stream, ReadOnlyMemory<byte> buffer)
{
if (MemoryMarshal.TryGetArray(buffer, out var segment))
{
stream.Write(segment.Array, segment.Offset, segment.Count);
return;
}
byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length);
try
{
buffer.Span.CopyTo(array);
stream.Write(array, 0, buffer.Length);
}
finally
{
ArrayPool<byte>.Shared.Return(array);
}
}
public static ValueTask WriteAsync(this Stream stream, ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (MemoryMarshal.TryGetArray(buffer, out var segment))
{
return new ValueTask(stream.WriteAsync(segment.Array, segment.Offset, segment.Count, cancellationToken));
}
byte[] array = ArrayPool<byte>.Shared.Rent(buffer.Length);
buffer.Span.CopyTo(array);
return new ValueTask(FinishWriteAsync(stream.WriteAsync(array, 0, buffer.Length, cancellationToken), array));
}
private static async Task FinishWriteAsync(Task writeTask, byte[] localBuffer)
{
try
{
await writeTask.ConfigureAwait(continueOnCapturedContext: false);
}
finally
{
ArrayPool<byte>.Shared.Return(localBuffer);
}
}
public static Task CopyToAsync(this Stream source, Stream destination, CancellationToken cancellationToken = default(CancellationToken))
{
return source.CopyToAsync(destination, 81920, cancellationToken);
}
}
}
namespace System.Reflection
{
internal sealed class NullabilityInfo
{
public Type Type { get; }
public NullabilityState ReadState { get; internal set; }
public NullabilityState WriteState { get; internal set; }
public NullabilityInfo ElementType { get; }
public NullabilityInfo[] GenericTypeArguments { get; }
internal NullabilityInfo(Type type, NullabilityState readState, NullabilityState writeState, NullabilityInfo elementType, NullabilityInfo[] typeArguments)
{
Type = type;
ReadState = readState;
WriteState = writeState;
ElementType = elementType;
GenericTypeArguments = typeArguments;
}
}
internal enum NullabilityState
{
Unknown,
NotNull,
Nullable
}
internal sealed class NullabilityInfoContext
{
[Flags]
private enum NotAnnotatedStatus
{
None = 0,
Private = 1,
Internal = 2
}
private readonly struct NullableAttributeStateParser
{
private static readonly object UnknownByte = (byte)0;
private readonly object _nullableAttributeArgument;
public static NullableAttributeStateParser Unknown => new NullableAttributeStateParser(UnknownByte);
public NullableAttributeStateParser(object nullableAttributeArgument)
{
_nullableAttributeArgument = nullableAttributeArgument;
}
public bool ParseNullableState(int index, ref NullabilityState state)
{
object nullableAttributeArgument = _nullableAttributeArgument;
if (!(nullableAttributeArgument is byte b))
{
if (nullableAttributeArgument is ReadOnlyCollection<CustomAttributeTypedArgument> readOnlyCollection)
{
ReadOnlyCollection<CustomAttributeTypedArgument> readOnlyCollection2 = readOnlyCollection;
if (index < readOnlyCollection2.Count && readOnlyCollection2[index].Value is byte b2)
{
state = TranslateByte(b2);
return true;
}
}
return false;
}
byte b3 = b;
state = TranslateByte(b3);
return true;
}
}
private const string CompilerServicesNameSpace = "System.Runtime.CompilerServices";
private readonly Dictionary<Module, NotAnnotatedStatus> _publicOnlyModules = new Dictionary<Module, NotAnnotatedStatus>();
private readonly Dictionary<MemberInfo, NullabilityState> _context = new Dictionary<MemberInfo, NullabilityState>();
private NullabilityState? GetNullableContext(MemberInfo memberInfo)
{
while (memberInfo != null)
{
if (_context.TryGetValue(memberInfo, out var value))
{
return value;
}
foreach (CustomAttributeData customAttributesDatum in memberInfo.GetCustomAttributesData())
{
if (customAttributesDatum.AttributeType.Name == "NullableContextAttribute" && customAttributesDatum.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttributesDatum.ConstructorArguments.Count == 1)
{
value = TranslateByte(customAttributesDatum.ConstructorArguments[0].Value);
_context.Add(memberInfo, value);
return value;
}
}
memberInfo = memberInfo.DeclaringType;
}
return null;
}
public NullabilityInfo Create(ParameterInfo parameterInfo)
{
ExceptionPolyfills.ThrowIfNull(parameterInfo, "parameterInfo");
IList<CustomAttributeData> customAttributesData = parameterInfo.GetCustomAttributesData();
NullableAttributeStateParser parser = ((parameterInfo.Member is MethodBase method && IsPrivateOrInternalMethodAndAnnotationDisabled(method)) ? NullableAttributeStateParser.Unknown : CreateParser(customAttributesData));
NullabilityInfo nullabilityInfo = GetNullabilityInfo(parameterInfo.Member, parameterInfo.ParameterType, parser);
if (nullabilityInfo.ReadState != 0)
{
CheckParameterMetadataType(parameterInfo, nullabilityInfo);
}
CheckNullabilityAttributes(nullabilityInfo, customAttributesData);
return nullabilityInfo;
}
private void CheckParameterMetadataType(ParameterInfo parameter, NullabilityInfo nullability)
{
MemberInfo member = parameter.Member;
MemberInfo metaMember;
ParameterInfo parameterInfo;
if (!(member is ConstructorInfo member2))
{
if (!(member is MethodInfo method))
{
return;
}
MethodInfo methodMetadataDefinition = GetMethodMetadataDefinition(method);
metaMember = methodMetadataDefinition;
parameterInfo = (string.IsNullOrEmpty(parameter.Name) ? methodMetadataDefinition.ReturnParameter : GetMetaParameter(methodMetadataDefinition, parameter));
}
else
{
parameterInfo = GetMetaParameter((MethodBase)(metaMember = (ConstructorInfo)GetMemberMetadataDefinition(member2)), parameter);
}
if (parameterInfo != null)
{
CheckGenericParameters(nullability, metaMember, parameterInfo.ParameterType, parameter.Member.ReflectedType);
}
}
private static ParameterInfo GetMetaParameter(MethodBase metaMethod, ParameterInfo parameter)
{
ReadOnlySpan<ParameterInfo> parametersAsSpan = metaMethod.GetParametersAsSpan();
for (int i = 0; i < parametersAsSpan.Length; i++)
{
if (parameter.Position == i && parameter.Name == parametersAsSpan[i].Name)
{
return parametersAsSpan[i];
}
}
return null;
}
private static MethodInfo GetMethodMetadataDefinition(MethodInfo method)
{
if (method.IsGenericMethod && !method.IsGenericMethodDefinition)
{
method = method.GetGenericMethodDefinition();
}
return (MethodInfo)GetMemberMetadataDefinition(method);
}
private static void CheckNullabilityAttributes(NullabilityInfo nullability, IList<CustomAttributeData> attributes)
{
NullabilityState nullabilityState = NullabilityState.Unknown;
NullabilityState nullabilityState2 = NullabilityState.Unknown;
foreach (CustomAttributeData attribute in attributes)
{
if (attribute.AttributeType.Namespace == "System.Diagnostics.CodeAnalysis")
{
if (attribute.AttributeType.Name == "NotNullAttribute")
{
nullabilityState = NullabilityState.NotNull;
}
else if ((attribute.AttributeType.Name == "MaybeNullAttribute" || attribute.AttributeType.Name == "MaybeNullWhenAttribute") && nullabilityState == NullabilityState.Unknown && !IsValueTypeOrValueTypeByRef(nullability.Type))
{
nullabilityState = NullabilityState.Nullable;
}
else if (attribute.AttributeType.Name == "DisallowNullAttribute")
{
nullabilityState2 = NullabilityState.NotNull;
}
else if (attribute.AttributeType.Name == "AllowNullAttribute" && nullabilityState2 == NullabilityState.Unknown && !IsValueTypeOrValueTypeByRef(nullability.Type))
{
nullabilityState2 = NullabilityState.Nullable;
}
}
}
if (nullabilityState != 0)
{
nullability.ReadState = nullabilityState;
}
if (nullabilityState2 != 0)
{
nullability.WriteState = nullabilityState2;
}
}
public NullabilityInfo Create(PropertyInfo propertyInfo)
{
ExceptionPolyfills.ThrowIfNull(propertyInfo, "propertyInfo");
MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true);
MethodInfo setMethod = propertyInfo.GetSetMethod(nonPublic: true);
NullableAttributeStateParser parser = (((getMethod == null || IsPrivateOrInternalMethodAndAnnotationDisabled(getMethod)) && (setMethod == null || IsPrivateOrInternalMethodAndAnnotationDisabled(setMethod))) ? NullableAttributeStateParser.Unknown : CreateParser(propertyInfo.GetCustomAttributesData()));
NullabilityInfo nullabilityInfo = GetNullabilityInfo(propertyInfo, propertyInfo.PropertyType, parser);
if (getMethod != null)
{
CheckNullabilityAttributes(nullabilityInfo, getMethod.ReturnParameter.GetCustomAttributesData());
}
else
{
nullabilityInfo.ReadState = NullabilityState.Unknown;
}
if (setMethod != null)
{
ReadOnlySpan<ParameterInfo> parametersAsSpan = setMethod.GetParametersAsSpan();
ParameterInfo parameterInfo = parametersAsSpan[parametersAsSpan.Length - 1];
CheckNullabilityAttributes(nullabilityInfo, parameterInfo.GetCustomAttributesData());
}
else
{
nullabilityInfo.WriteState = NullabilityState.Unknown;
}
return nullabilityInfo;
}
private bool IsPrivateOrInternalMethodAndAnnotationDisabled(MethodBase method)
{
if ((method.IsPrivate || method.IsFamilyAndAssembly || method.IsAssembly) && IsPublicOnly(method.IsPrivate, method.IsFamilyAndAssembly, method.IsAssembly, method.Module))
{
return true;
}
return false;
}
public NullabilityInfo Create(EventInfo eventInfo)
{
ExceptionPolyfills.ThrowIfNull(eventInfo, "eventInfo");
return GetNullabilityInfo(eventInfo, eventInfo.EventHandlerType, CreateParser(eventInfo.GetCustomAttributesData()));
}
public NullabilityInfo Create(FieldInfo fieldInfo)
{
ExceptionPolyfills.ThrowIfNull(fieldInfo, "fieldInfo");
IList<CustomAttributeData> customAttributesData = fieldInfo.GetCustomAttributesData();
NullableAttributeStateParser parser = (IsPrivateOrInternalFieldAndAnnotationDisabled(fieldInfo) ? NullableAttributeStateParser.Unknown : CreateParser(customAttributesData));
NullabilityInfo nullabilityInfo = GetNullabilityInfo(fieldInfo, fieldInfo.FieldType, parser);
CheckNullabilityAttributes(nullabilityInfo, customAttributesData);
return nullabilityInfo;
}
private bool IsPrivateOrInternalFieldAndAnnotationDisabled(FieldInfo fieldInfo)
{
if ((fieldInfo.IsPrivate || fieldInfo.IsFamilyAndAssembly || fieldInfo.IsAssembly) && IsPublicOnly(fieldInfo.IsPrivate, fieldInfo.IsFamilyAndAssembly, fieldInfo.IsAssembly, fieldInfo.Module))
{
return true;
}
return false;
}
private bool IsPublicOnly(bool isPrivate, bool isFamilyAndAssembly, bool isAssembly, Module module)
{
if (!_publicOnlyModules.TryGetValue(module, out var value))
{
value = PopulateAnnotationInfo(module.GetCustomAttributesData());
_publicOnlyModules.Add(module, value);
}
if (value == NotAnnotatedStatus.None)
{
return false;
}
if (((isPrivate || isFamilyAndAssembly) && value.HasFlag(NotAnnotatedStatus.Private)) || (isAssembly && value.HasFlag(NotAnnotatedStatus.Internal)))
{
return true;
}
return false;
}
private static NotAnnotatedStatus PopulateAnnotationInfo(IList<CustomAttributeData> customAttributes)
{
bool flag = default(bool);
foreach (CustomAttributeData customAttribute in customAttributes)
{
if (customAttribute.AttributeType.Name == "NullablePublicOnlyAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttribute.ConstructorArguments.Count == 1)
{
object value = customAttribute.ConstructorArguments[0].Value;
int num;
if (value is bool)
{
flag = (bool)value;
num = 1;
}
else
{
num = 0;
}
if (((uint)num & (flag ? 1u : 0u)) != 0)
{
return NotAnnotatedStatus.Private | NotAnnotatedStatus.Internal;
}
return NotAnnotatedStatus.Private;
}
}
return NotAnnotatedStatus.None;
}
private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser)
{
int index = 0;
NullabilityInfo nullabilityInfo = GetNullabilityInfo(memberInfo, type, parser, ref index);
if (nullabilityInfo.ReadState != 0)
{
TryLoadGenericMetaTypeNullability(memberInfo, nullabilityInfo);
}
return nullabilityInfo;
}
private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser, ref int index)
{
NullabilityState state = NullabilityState.Unknown;
NullabilityInfo elementType = null;
NullabilityInfo[] array = Array.Empty<NullabilityInfo>();
Type type2 = type;
if (type2.IsByRef || type2.IsPointer)
{
type2 = type2.GetElementType();
}
if (type2.IsValueType)
{
Type underlyingType = Nullable.GetUnderlyingType(type2);
if ((object)underlyingType != null)
{
type2 = underlyingType;
state = NullabilityState.Nullable;
}
else
{
state = NullabilityState.NotNull;
}
if (type2.IsGenericType)
{
index++;
}
}
else
{
if (!parser.ParseNullableState(index++, ref state))
{
NullabilityState? nullableContext = GetNullableContext(memberInfo);
if (nullableContext.HasValue)
{
NullabilityState valueOrDefault = nullableContext.GetValueOrDefault();
state = valueOrDefault;
}
}
if (type2.IsArray)
{
elementType = GetNullabilityInfo(memberInfo, type2.GetElementType(), parser, ref index);
}
}
if (type2.IsGenericType)
{
Type[] genericArguments = type2.GetGenericArguments();
array = new NullabilityInfo[genericArguments.Length];
for (int i = 0; i < genericArguments.Length; i++)
{
array[i] = GetNullabilityInfo(memberInfo, genericArguments[i], parser, ref index);
}
}
return new NullabilityInfo(type, state, state, elementType, array);
}
private static NullableAttributeStateParser CreateParser(IList<CustomAttributeData> customAttributes)
{
foreach (CustomAttributeData customAttribute in customAttributes)
{
if (customAttribute.AttributeType.Name == "NullableAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttribute.ConstructorArguments.Count == 1)
{
return new NullableAttributeStateParser(customAttribute.ConstructorArguments[0].Value);
}
}
return new NullableAttributeStateParser(null);
}
private void TryLoadGenericMetaTypeNullability(MemberInfo memberInfo, NullabilityInfo nullability)
{
MemberInfo memberMetadataDefinition = GetMemberMetadataDefinition(memberInfo);
Type type = null;
if (memberMetadataDefinition is FieldInfo fieldInfo)
{
type = fieldInfo.FieldType;
}
else if (memberMetadataDefinition is PropertyInfo property)
{
type = GetPropertyMetaType(property);
}
if (type != null)
{
CheckGenericParameters(nullability, memberMetadataDefinition, type, memberInfo.ReflectedType);
}
}
private static MemberInfo GetMemberMetadataDefinition(MemberInfo member)
{
Type declaringType = member.DeclaringType;
if (declaringType != null && declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
{
return NetstandardHelpers.GetMemberWithSameMetadataDefinitionAs(declaringType.GetGenericTypeDefinition(), member);
}
return member;
}
private static Type GetPropertyMetaType(PropertyInfo property)
{
MethodInfo getMethod = property.GetGetMethod(nonPublic: true);
if ((object)getMethod != null)
{
return getMethod.ReturnType;
}
return property.GetSetMethod(nonPublic: true).GetParametersAsSpan()[0].ParameterType;
}
private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType, Type reflectedType)
{
if (metaType.IsGenericParameter)
{
if (nullability.ReadState == NullabilityState.NotNull)
{
TryUpdateGenericParameterNullability(nullability, metaType, reflectedType);
}
}
else
{
if (!metaType.ContainsGenericParameters)
{
return;
}
if (nullability.GenericTypeArguments.Length != 0)
{
Type[] genericArguments = metaType.GetGenericArguments();
for (int i = 0; i < genericArguments.Length; i++)
{
CheckGenericParameters(nullability.GenericTypeArguments[i], metaMember, genericArguments[i], reflectedType);
}
return;
}
NullabilityInfo elementType = nullability.ElementType;
if (elementType != null && metaType.IsArray)
{
CheckGenericParameters(elementType, metaMember, metaType.GetElementType(), reflectedType);
}
else if (metaType.IsByRef)
{
CheckGenericParameters(nullability, metaMember, metaType.GetElementType(), reflectedType);
}
}
}
private bool TryUpdateGenericParameterNullability(NullabilityInfo nullability, Type genericParameter, Type reflectedType)
{
if ((object)reflectedType != null && !genericParameter.IsGenericMethodParameter() && TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, reflectedType, reflectedType))
{
return true;
}
if (IsValueTypeOrValueTypeByRef(nullability.Type))
{
return true;
}
NullabilityState state = NullabilityState.Unknown;
if (CreateParser(genericParameter.GetCustomAttributesData()).ParseNullableState(0, ref state))
{
nullability.ReadState = state;
nullability.WriteState = state;
return true;
}
NullabilityState? nullableContext = GetNullableContext(genericParameter);
if (nullableContext.HasValue)
{
NullabilityState writeState = (nullability.ReadState = nullableContext.GetValueOrDefault());
nullability.WriteState = writeState;
return true;
}
return false;
}
private bool TryUpdateGenericTypeParameterNullabilityFromReflectedType(NullabilityInfo nullability, Type genericParameter, Type context, Type reflectedType)
{
Type type2 = ((context.IsGenericType && !context.IsGenericTypeDefinition) ? context.GetGenericTypeDefinition() : context);
if (genericParameter.DeclaringType == type2)
{
return false;
}
Type baseType = type2.BaseType;
if ((object)baseType == null)
{
return false;
}
if (!baseType.IsGenericType || (baseType.IsGenericTypeDefinition ? baseType : baseType.GetGenericTypeDefinition()) != genericParameter.DeclaringType)
{
return TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, baseType, reflectedType);
}
Type[] genericArguments = baseType.GetGenericArguments();
Type type3 = genericArguments[genericParameter.GenericParameterPosition];
if (type3.IsGenericParameter)
{
return TryUpdateGenericParameterNullability(nullability, type3, reflectedType);
}
NullableAttributeStateParser parser = CreateParser(type2.GetCustomAttributesData());
int index = 1;
for (int i = 0; i < genericParameter.GenericParameterPosition; i++)
{
index += CountNullabilityStates(genericArguments[i]);
}
return TryPopulateNullabilityInfo(nullability, parser, ref index);
static int CountNullabilityStates(Type type)
{
Type type4 = Nullable.GetUnderlyingType(type) ?? type;
if (type4.IsGenericType)
{
int num = 1;
Type[] genericArguments2 = type4.GetGenericArguments();
foreach (Type type5 in genericArguments2)
{
num += CountNullabilityStates(type5);
}
return num;
}
if (type4.HasElementType)
{
return (type4.IsArray ? 1 : 0) + CountNullabilityStates(type4.GetElementType());
}
return (!type.IsValueType) ? 1 : 0;
}
}
private static bool TryPopulateNullabilityInfo(NullabilityInfo nullability, NullableAttributeStateParser parser, ref int index)
{
bool flag = IsValueTypeOrValueTypeByRef(nullability.Type);
if (!flag)
{
NullabilityState state = NullabilityState.Unknown;
if (!parser.ParseNullableState(index, ref state))
{
return false;
}
nullability.ReadState = state;
nullability.WriteState = state;
}
if (!flag || (Nullable.GetUnderlyingType(nullability.Type) ?? nullability.Type).IsGenericType)
{
index++;
}
if (nullability.GenericTypeArguments.Length != 0)
{
NullabilityInfo[] genericTypeArguments = nullability.GenericTypeArguments;
for (int i = 0; i < genericTypeArguments.Length; i++)
{
TryPopulateNullabilityInfo(genericTypeArguments[i], parser, ref index);
}
}
else
{
NullabilityInfo elementType = nullability.ElementType;
if (elementType != null)
{
TryPopulateNullabilityInfo(elementType, parser, ref index);
}
}
return true;
}
private static NullabilityState TranslateByte(object value)
{
if (!(value is byte b))
{
return NullabilityState.Unknown;
}
return TranslateByte(b);
}
private static NullabilityState TranslateByte(byte b)
{
return b switch
{
1 => NullabilityState.NotNull,
2 => NullabilityState.Nullable,
_ => NullabilityState.Unknown,
};
}
private static bool IsValueTypeOrValueTypeByRef(Type type)
{
if (!type.IsValueType)
{
if (type.IsByRef || type.IsPointer)
{
return type.GetElementType().IsValueType;
}
return false;
}
return true;
}
}
internal static class NetstandardHelpers
{
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "This is finding the MemberInfo with the same MetadataToken as specified MemberInfo. If the specified MemberInfo exists and wasn't trimmed, then the current Type's MemberInfo couldn't have been trimmed.")]
public static MemberInfo GetMemberWithSameMetadataDefinitionAs(this Type type, MemberInfo member)
{
ExceptionPolyfills.ThrowIfNull(member, "member");
MemberInfo[] members = type.GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MemberInfo memberInfo in members)
{
if (HasSameMetadataDefinitionAs(memberInfo, member))
{
return memberInfo;
}
}
throw new MissingMemberException(type.FullName, member.Name);
}
private static bool HasSameMetadataDefinitionAs(this MemberInfo info, MemberInfo other)
{
if (info.MetadataToken != other.MetadataToken)
{
return false;
}
if (!info.Module.Equals(other.Module))
{
return false;
}
return true;
}
public static bool IsGenericMethodParameter(this Type type)
{
if (type.IsGenericParameter)
{
return (object)type.DeclaringMethod != null;
}
return false;
}
public static ReadOnlySpan<ParameterInfo> GetParametersAsSpan(this MethodBase metaMethod)
{
return metaMethod.GetParameters();
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
internal sealed class DynamicDependencyAttribute : Attribute
{
public string MemberSignature { get; }
public DynamicallyAccessedMemberTypes MemberTypes { get; }
public Type Type { get; }
public string TypeName { get; }
public string AssemblyName { get; }
[Obsolete("This property is no longer supported.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Condition { get; set; }
public DynamicDependencyAttribute(string memberSignature)
{
MemberSignature = memberSignature;
}
public DynamicDependencyAttribute(string memberSignature, Type type)
{
MemberSignature = memberSignature;
Type = type;
}
public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName)
{
MemberSignature = memberSignature;
TypeName = typeName;
AssemblyName = assemblyName;
}
public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, Type type)
{
MemberTypes = memberTypes;
Type = type;
}
public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName)
{
MemberTypes = memberTypes;
TypeName = typeName;
AssemblyName = assemblyName;
}
}
[CompilerLoweringPreserve]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
internal sealed class DynamicallyAccessedMembersAttribute : Attribute
{
public DynamicallyAccessedMemberTypes MemberTypes { get; }
public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
{
MemberTypes = memberTypes;
}
}
[Flags]
internal enum DynamicallyAccessedMemberTypes
{
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 0x10,
PublicFields = 0x20,
NonPublicFields = 0x40,
PublicNestedTypes = 0x80,
NonPublicNestedTypes = 0x100,
PublicProperties = 0x200,
NonPublicProperties = 0x400,
PublicEvents = 0x800,
NonPublicEvents = 0x1000,
Interfaces = 0x2000,
NonPublicConstructorsWithInherited = 0x4004,
NonPublicMethodsWithInherited = 0x8010,
NonPublicFieldsWithInherited = 0x10040,
NonPublicNestedTypesWithInherited = 0x20100,
NonPublicPropertiesWithInherited = 0x40400,
NonPublicEventsWithInherited = 0x81000,
PublicConstructorsWithInherited = 0x100003,
PublicNestedTypesWithInherited = 0x200080,
AllConstructors = 0x104007,
AllMethods = 0x8018,
AllFields = 0x10060,
AllNestedTypes = 0x220180,
AllProperties = 0x40600,
AllEvents = 0x81800,
[EditorBrowsable(EditorBrowsableState.Never)]
All = -1
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
internal sealed class RequiresUnreferencedCodeAttribute : Attribute
{
public bool ExcludeStatics { get; set; }
public string Message { get; }
public string Url { get; set; }
public RequiresUnreferencedCodeAttribute(string message)
{
Message = message;
}
}
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
internal sealed class UnconditionalSuppressMessageAttribute : Attribute
{
public string Category { get; }
public string CheckId { get; }
public string Scope { get; set; }
public string Target { get; set; }
public string MessageId { get; set; }
public string Justification { get; set; }
public UnconditionalSuppressMessageAttribute(string category, string checkId)
{
Category = category;
CheckId = checkId;
}
}
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
internal sealed class FeatureSwitchDefinitionAttribute : Attribute
{
public string SwitchName { get; }
public FeatureSwitchDefinitionAttribute(string switchName)
{
SwitchName = switchName;
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = Array.Empty<object>();
}
public StringSyntaxAttribute(string syntax, params object[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
internal sealed class RequiresDynamicCodeAttribute : Attribute
{
public bool ExcludeStatics { get; set; }
public string Message { get; }
public string Url { get; set; }
public RequiresDynamicCodeAttribute(string message)
{
Message = message;
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
internal sealed class AllowNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
internal sealed class DisallowNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
internal sealed class MaybeNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
internal sealed class NotNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class MaybeNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public MaybeNullWhenAttribute(bool returnValue)
{
ReturnValue = returnValue;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class NotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public NotNullWhenAttribute(bool returnValue)
{
ReturnValue = returnValue;
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
internal sealed class NotNullIfNotNullAttribute : Attribute
{
public string ParameterName { get; }
public NotNullIfNotNullAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
internal sealed class DoesNotReturnAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class DoesNotReturnIfAttribute : Attribute
{
public bool ParameterValue { get; }
public DoesNotReturnIfAttribute(bool parameterValue)
{
ParameterValue = parameterValue;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace System.Collections
{
internal static class HashHelpers
{
public const uint HashCollisionThreshold = 100u;
public const int MaxPrimeArrayLength = 2147483587;
public const int HashPrime = 101;
internal static ReadOnlySpan<int> Primes
{
get
{
object obj = global::<PrivateImplementationDetails>.74BCD6ED20AF2231F2BB1CDE814C5F4FF48E54BAC46029EEF90DDF4A208E2B20_A6;
if (obj == null)
{
obj = new int[72