From 82e1308bdc2e4ae17e334666b5aed70b31c036c8 Mon Sep 17 00:00:00 2001 From: "David G. Moore, Jr." Date: Wed, 24 Jan 2024 13:56:37 -0500 Subject: [PATCH] Fixing the polyfills --- All/LICENSE.md | 35 + README.md | 6 +- src/Abstractions/IRegexValueObject.cs | 179 +- .../IStringWithRegexValueObject.cs | 5 +- src/Abstractions/IUriConvertible{T}.cs | 32 +- src/Dgmjr.Primitives.csproj | 10 +- src/EmailAddress.cs | 44 +- src/IsExternalInit.cs | 25 + src/ObjectId.cs | 51 +- src/OpenApiRegistrations.cs | 49 +- src/PRE_NET6_0_POLYFILLS/DateOnly.cs | 372 --- src/PRE_NET6_0_POLYFILLS/DateOnly2.cs | 411 --- .../DisallowNullAttribute.cs | 9 - .../DoesNotReturnAttribute.cs | 11 - .../DynamicallyAccessedMemberTypes.cs | 29 - .../DynamicallyAccessedMembersAttribute.cs | 30 - src/PRE_NET6_0_POLYFILLS/ExceptionArgument.cs | 111 - src/PRE_NET6_0_POLYFILLS/ExceptionResource.cs | 90 - .../FastResourceComparer.cs | 134 - .../MemberNotNullAttribute.cs | 29 - .../RequiresDynamicCodeAttribute.cs | 24 - .../RequiresUnreferencedCode.cs | 24 - src/PRE_NET6_0_POLYFILLS/ResourceLocator.cs | 26 - src/PRE_NET6_0_POLYFILLS/ResourceReader.cs | 1155 ------- src/PRE_NET6_0_POLYFILLS/ResourceTypeCode.cs | 33 - .../RuntimeResourceSet.cs | 194 -- src/PRE_NET6_0_POLYFILLS/SR.cs | 2719 ----------------- src/PRE_NET6_0_POLYFILLS/SpanHelper.cs | 58 - src/PRE_NET6_0_POLYFILLS/ThrowHelper.cs | 935 ------ src/PRE_NET6_0_POLYFILLS/TimeOnly.cs | 244 -- src/PRE_NET6_0_POLYFILLS/TimeOnly2.cs | 191 -- src/PhoneNumber.cs | 36 +- src/Polyfill/IsExternalInit.cs | 14 + src/iri.cs | 29 +- src/uri.cs | 36 +- src/url.cs | 31 +- src/urn.cs | 34 +- src/xri.cs | 27 +- 38 files changed, 417 insertions(+), 7055 deletions(-) create mode 100644 All/LICENSE.md create mode 100644 src/IsExternalInit.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DateOnly.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DateOnly2.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DisallowNullAttribute.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DoesNotReturnAttribute.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMemberTypes.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMembersAttribute.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ExceptionArgument.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ExceptionResource.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/FastResourceComparer.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/MemberNotNullAttribute.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/RequiresDynamicCodeAttribute.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/RequiresUnreferencedCode.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ResourceLocator.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ResourceReader.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ResourceTypeCode.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/RuntimeResourceSet.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/SR.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/SpanHelper.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/ThrowHelper.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/TimeOnly.cs delete mode 100644 src/PRE_NET6_0_POLYFILLS/TimeOnly2.cs create mode 100644 src/Polyfill/IsExternalInit.cs diff --git a/All/LICENSE.md b/All/LICENSE.md new file mode 100644 index 0000000..4f592f8 --- /dev/null +++ b/All/LICENSE.md @@ -0,0 +1,35 @@ +--- +date: 2023-07-13T05:44:46:00-05:00Z +description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda... +keywords: +- IP +- copyright +- license +- mit +permissions: +- commercial-use +- modifications +- distribution +- private-use +conditions: +- include-copyright +limitations: +- liability +- warranty +lastmod: 2024-01-0T00:39:00.0000+05:00Z +license: MIT +slug: mit-license +title: MIT License +type: license +--- + +# MIT License + +## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:david@dgmjr.io "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md index 2b08fdd..2b35f85 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Key features: ```csharp var email = EmailAddress.From("user@example.com"); -if (email.IsEmpty) { +if (!email.IsEmpty) { // use email } ``` @@ -126,9 +126,9 @@ if (id.IsEmpty) { - [`Int24`](https://github.com/dgmjr-io/Primitives/blob/main/src/Int24.cs) - a 24-bit signed integer (*alias: i24*) - [`UInt24`](https://github.com/dgmjr-io/Primitives/blob/main/src/Int24.cs) - a 24-bit unsigned integer (*alias: ui24*) -## The `blank` Resource `blank`s +## The `X` Resource `Y`s -These are a collection of `blank` Resource `blank`s. +These are a collection of `X` Resource `Y`s. - [`iri`](https://github.com/dgmjr-io/Primitives/blob/main/src/iri.cs) - An internationalized resource identifier - [`uri`](https://github.com/dgmjr-io/Primitives/blob/main/src/uri.cs) - A uniform resource identifier diff --git a/src/Abstractions/IRegexValueObject.cs b/src/Abstractions/IRegexValueObject.cs index d503807..c146e1c 100644 --- a/src/Abstractions/IRegexValueObject.cs +++ b/src/Abstractions/IRegexValueObject.cs @@ -8,77 +8,142 @@ public interface IRegexValueObject IComparable, IEquatable, IHaveAUri -#if NET7_0_OR_GREATER - , - IParsable, - IUriConvertible -#endif - where TSelf : IRegexValueObject { - /// Gets The value of the value object as a string. Will be or iff == - string Value { get; } + // #if NET7_0_OR_GREATER + // , + // IParsable, + // IUriConvertible + // #endif + // where TSelf : IRegexValueObject + // { + // /// Gets The value of the value object as a string. Will be or iff == + // string Value { get; } + + // /// if the value object is empty, otherwise + // /// if the value object is empty, otherwise + // bool IsEmpty { get; } + + // #if NET6_0_OR_GREATER + // // /// Gets + // // /// a containing the regular expression, which can be used to parse/validate string versions of the value object + // // public abstract static Regex Regex(); + + // /// Gets + // /// the regular expression (as a string), which can be used to parse/validate string versions of the value object + // public abstract static string RegexString { get; } + + // /// Gets + // /// the name of the value object + // public virtual static string Name { get; } = typeof(TSelf).Name; + + // /// Gets + // /// a description of the value object type + // public abstract static string Description { get; } + + // /// Parses the into + // /// an instance of iff the parses properly + // /// thrown if the value object fails validation + // /// thrown if parsing the failed for some other reason + // public abstract static TSelf Parse(string value); + + // /// Generates + // /// an instance of iff the parses properly + // /// thrown if the value object fails validation + // /// thrown if parsing the failed for some other reason + // public abstract static TSelf From(string value); - /// if the value object is empty, otherwise - /// if the value object is empty, otherwise - bool IsEmpty { get; } + // /// Gets + // /// an example (archetypal) value for the value object + // public abstract static TSelf ExampleValue { get; } -#if NET6_0_OR_GREATER - /// Gets - /// a containing the regular expression, which can be used to parse/validate string versions of the value object - public abstract static Regex Regex(); + // /// Gets the empty representation of this value object + // public static abstract TSelf Empty { get; } + // // public abstract static Validation Validate(string value); + // /// Gets the "external documentation" for the value object + // public static virtual ExternalDocsTuple? ExternalDocumentation => null; + // #else + // // /// Gets + // // /// the regular expression (as a string), which can be used to parse/validate string versions of the value object + // // string RegexString { get; } + + // // /// Gets + // // /// a description of the value object type + // // string Description { get; } + + // // /// Gets + // // /// an example (archetypal) value for the value object + // // TSelf ExampleValue { get; } + + // // /// Returns + // // /// a containing the regular expression, which can be used to parse/validate string versions of the value object + // // Regex Regex(); +} + +// /// Gets the original string that was parsed to create the value object +// string OriginalString { get; } +// } + +internal record struct RegexValueObject : IRegexValueObject +{ /// Gets /// the regular expression (as a string), which can be used to parse/validate string versions of the value object - public abstract static string RegexString { get; } + public static string RegexString => throw new NotImplementedException(); /// Gets /// the name of the value object - public virtual static string Name { get; } = typeof(TSelf).Name; + public static string Name => throw new NotImplementedException(); /// Gets /// a description of the value object type - public abstract static string Description { get; } - - /// Parses the into - /// an instance of iff the parses properly - /// thrown if the value object fails validation - /// thrown if parsing the failed for some other reason - public abstract static TSelf Parse(string value); - - /// Generates - /// an instance of iff the parses properly - /// thrown if the value object fails validation - /// thrown if parsing the failed for some other reason - public abstract static TSelf From(string value); - - /// Gets - /// an example (archetypal) value for the value object - public abstract static TSelf ExampleValue { get; } - - /// Gets the empty representation of this value object - public static abstract TSelf Empty { get; } - - // public abstract static Validation Validate(string value); - /// Gets the "external documentation" for the value object - public static virtual ExternalDocsTuple? ExternalDocumentation => null; -#else - /// Gets - /// the regular expression (as a string), which can be used to parse/validate string versions of the value object - string RegexString { get; } + public static string Description => throw new NotImplementedException(); - /// Gets - /// a description of the value object type - string Description { get; } + public static ExternalDocsTuple? ExternalDocumentation => throw new NotImplementedException(); - /// Gets - /// an example (archetypal) value for the value object - TSelf ExampleValue { get; } + public static RegexValueObject ExampleValue => throw new NotImplementedException(); - /// Returns - /// a containing the regular expression, which can be used to parse/validate string versions of the value object - Regex Regex(); -#endif + public static RegexValueObject Empty => throw new NotImplementedException(); + + public string Value => throw new NotImplementedException(); + + public bool IsEmpty => throw new NotImplementedException(); + + public string OriginalString => throw new NotImplementedException(); + + public Uri Uri => throw new NotImplementedException(); + + public static RegexValueObject Parse(string value) + { + throw new NotImplementedException(); + } + + public static RegexValueObject From(string value) + { + throw new NotImplementedException(); + } + + public static RegexValueObject From(Uri uri) + { + throw new NotImplementedException(); + } + + public static RegexValueObject Parse(string s, IFormatProvider? provider) + { + throw new NotImplementedException(); + } + + public static bool TryParse(string s, IFormatProvider? provider, out RegexValueObject result) + { + throw new NotImplementedException(); + } + + public int CompareTo(RegexValueObject other) + { + throw new NotImplementedException(); + } - /// Gets the original string that was parsed to create the value object - string OriginalString { get; } + public int CompareTo(object obj) + { + throw new NotImplementedException(); + } } diff --git a/src/Abstractions/IStringWithRegexValueObject.cs b/src/Abstractions/IStringWithRegexValueObject.cs index 068bcf2..f090a9b 100644 --- a/src/Abstractions/IStringWithRegexValueObject.cs +++ b/src/Abstractions/IStringWithRegexValueObject.cs @@ -1,5 +1,4 @@ namespace System; -public interface IStringWithRegexValueObject : IRegexValueObject - where TSelf : IStringWithRegexValueObject -{ } +public interface IStringWithRegexValueObject // : IRegexValueObject + where TSelf : IStringWithRegexValueObject { } diff --git a/src/Abstractions/IUriConvertible{T}.cs b/src/Abstractions/IUriConvertible{T}.cs index 3cf917d..38c4652 100644 --- a/src/Abstractions/IUriConvertible{T}.cs +++ b/src/Abstractions/IUriConvertible{T}.cs @@ -1,16 +1,16 @@ -namespace System; - -public interface IUriConvertible - where T : IUriConvertible, IHaveAUri -{ -#if NET70_OR_GREATER - public static virtual T FromUri(Uri uri) => - typeof(T).IsAssignableFrom(typeof(Uri)) - ? (T)uri - : new FromUri(uri?.ToString() ?? string.Empty); - public static virtual T FromUri(string uri) => - typeof(T).IsAssignableFrom(typeof(Uri)) - ? (T)new Uri(uri) - : new FromUri(uri ?? string.Empty); -#endif -} +namespace System; + +public interface IUriConvertible : IHaveAUri + where T : IUriConvertible, IHaveAUri +{ +#if NET70_OR_GREATER + public static virtual T FromUri(Uri uri) => + typeof(T).IsAssignableFrom(typeof(Uri)) + ? (T)uri + : new FromUri(uri?.ToString() ?? string.Empty); + public static virtual T FromUri(string uri) => + typeof(T).IsAssignableFrom(typeof(Uri)) + ? (T)new Uri(uri) + : new FromUri(uri ?? string.Empty); +#endif +} diff --git a/src/Dgmjr.Primitives.csproj b/src/Dgmjr.Primitives.csproj index b9593a0..ec1d20b 100644 --- a/src/Dgmjr.Primitives.csproj +++ b/src/Dgmjr.Primitives.csproj @@ -12,7 +12,7 @@ - netstandard2.0;netstandard2.1;net6.0;net8.0 + netstandard2.0;net6.0;net8.0 preview Dgmjr.Primitives @@ -50,15 +50,14 @@ - + + - - @@ -77,4 +76,7 @@ + + + diff --git a/src/EmailAddress.cs b/src/EmailAddress.cs index 83d475d..877f2a1 100644 --- a/src/EmailAddress.cs +++ b/src/EmailAddress.cs @@ -40,7 +40,7 @@ public partial record struct EmailAddress : IRegexValueObject, IFo /// /// The description. /// - public const string Description = "an email address in the form of *user@domain.ext*"; + public const string DescriptionString = "an email address in the form of *user@domain.ext*"; public const string UriPrefix = "mailto:"; public const string UriPattern = $"{UriPrefix}{{0}}"; @@ -48,31 +48,27 @@ public partial record struct EmailAddress : IRegexValueObject, IFo public string OriginalString { get; init; } -#if NET6_0_OR_GREATER + // #if NET6_0_OR_GREATER /// /// Gets the description. /// - static string IRegexValueObject.Description => Description; + public static string Description => DescriptionString; /// /// Gets the example value. /// - static EmailAddress IRegexValueObject.ExampleValue => From(ExampleValueString); - - /// - /// Gets the regex string. - /// - static string IRegexValueObject.RegexString => RegexString; + public static EmailAddress ExampleValue => From(ExampleValueString); public static ExternalDocsTuple ExternalDocs => ("Email Address", new Uri("https://en.wikipedia.org/wiki/Email_address")); -#else - readonly Regex IRegexValueObject.Regex() => Regex(); - readonly string IRegexValueObject.RegexString => RegexString; - readonly string IRegexValueObject.Description => Description; - readonly EmailAddress IRegexValueObject.ExampleValue => From(ExampleValueString); -#endif + // #else + // readonly Regex Regex() => Regex(); + + // readonly string RegexString => RegexString; + // readonly string Description => Description; + // readonly EmailAddress ExampleValue => From(ExampleValueString); + // #endif /// /// Gets a value indicating whether is empty. @@ -168,15 +164,15 @@ s is null /// public readonly override string ToString() => IsEmpty ? string.Empty : Value; - /// - /// Returns - /// - /// The obj. - /// a negative value if the current value is less than - /// , 0 if they're equal, and a positive value if - /// it's greater than .. - public readonly int CompareTo(object? obj) => - CompareOrdinal(Value, obj?.ToString() ?? string.Empty); + // /// + // /// Returns + // /// + // /// The obj. + // /// a negative value if the current value is less than + // /// , 0 if they're equal, and a positive value if + // /// it's greater than .. + // public readonly int CompareTo(object? obj) => + // CompareOrdinal(Value, obj?.ToString() ?? string.Empty); /// /// Parses the . diff --git a/src/IsExternalInit.cs b/src/IsExternalInit.cs new file mode 100644 index 0000000..36adec4 --- /dev/null +++ b/src/IsExternalInit.cs @@ -0,0 +1,25 @@ +#if NET5_0_OR_GREATER + +[assembly: System.Runtime.CompilerServices.TypeForwardedTo( + typeof(System.Runtime.CompilerServices.IsExternalInit) +)] + +#else + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +using System.ComponentModel; + +namespace System.Runtime.CompilerServices; + +// https://github.com/dotnet/runtime/blob/v8.0.0/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsExternalInit.cs + +/// +/// Reserved to be used by the compiler for tracking metadata. +/// This class should not be used by developers in source code. +/// +[EditorBrowsable(EditorBrowsableState.Never)] +internal // polyfill! +static class IsExternalInit { } + +#endif diff --git a/src/ObjectId.cs b/src/ObjectId.cs index 2e204c6..2050ab3 100644 --- a/src/ObjectId.cs +++ b/src/ObjectId.cs @@ -38,11 +38,13 @@ public readonly partial record struct ObjectId private static System.Security.Cryptography.RandomNumberGenerator Random = System.Security.Cryptography.RandomNumberGenerator.Create(); - public const string Description = + public const string DescriptionString = "A ObjectId is a 24-digit (96-bit) hexadecimal string that uniquely identifies an object in a database"; -#if NET6_0_OR_GREATER - static string IRegexValueObject.Description => Description; -#endif + + // #if NET6_0_OR_GREATER + public static string Description => DescriptionString; + + // #endif public const string EmptyValue = "000000000000000000000000"; public const int Length = 24; public const string RegexString = "^[0-9a-z]{24}$"; @@ -82,9 +84,10 @@ public static ObjectId NewId() public readonly bool IsEmpty => Value == EmptyValue; public string OriginalString { get; init; } -#if NET6_0_OR_GREATER - static string IRegexValueObject.RegexString => RegexString; -#endif + // #if NET6_0_OR_GREATER + // static string IRegexValueObject.RegexString => RegexString; + + // #endif public const string ExampleValueString = "abcdef0123456789abcdef01"; public static ObjectId ExampleValue => @@ -94,13 +97,13 @@ public static ObjectId NewId() }; #if !NET6_0_OR_GREATER - readonly Regex IRegexValueObject.Regex() => Regex(); + // readonly Regex IRegexValueObject.Regex() => Regex(); - readonly string IRegexValueObject.RegexString => RegexString; + // readonly string IRegexValueObject.RegexString => RegexString; - readonly string IRegexValueObject.Description => Description; + // readonly string IRegexValueObject.Description => Description; - readonly ObjectId IRegexValueObject.ExampleValue => ExampleValue; + // readonly ObjectId IRegexValueObject.ExampleValue => ExampleValue; #endif public static implicit operator ObjectId(byte[] value) => From(value); @@ -157,14 +160,14 @@ public static bool TryParse(string s, out ObjectId result) return true; } - // public override bool Equals(object? obj) => obj is ObjectId other && Equals(other); - // public bool Equals(ObjectId other) => _value == other._value; - // public override int GetHashCode() => _value.GetHashCode(); - // public int CompareTo(ObjectId other) => _value.CompareTo(other._value); - public readonly int CompareTo(object? obj) => - obj is ObjectId other - ? CompareTo(other) - : throw new ArgumentException($"object must be of type {nameof(ObjectId)}"); + // // public override bool Equals(object? obj) => obj is ObjectId other && Equals(other); + // // public bool Equals(ObjectId other) => _value == other._value; + // // public override int GetHashCode() => _value.GetHashCode(); + // // public int CompareTo(ObjectId other) => _value.CompareTo(other._value); + // public readonly int CompareTo(object? obj) => + // obj is ObjectId other + // ? CompareTo(other) + // : throw new ArgumentException($"object must be of type {nameof(ObjectId)}"); // public override string ToString() => _value.ToString(); @@ -201,8 +204,14 @@ public static ObjectId Parse(string s, IFormatProvider? provider) => }; public static bool TryParse(string? s, IFormatProvider? provider, out ObjectId result) => - (result = Validate(s).ErrorMessage is null ? From(s) with { OriginalString = s } : default) - != default; + ( + result = Validate(s).ErrorMessage is null + ? From(s) with + { + OriginalString = s + } + : default(ObjectId) + ) != default(ObjectId); public static int CurrentTimestamp => (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(); public static byte[] CurrentTimestampBytes => diff --git a/src/OpenApiRegistrations.cs b/src/OpenApiRegistrations.cs index f5d116f..f8ce7c0 100644 --- a/src/OpenApiRegistrations.cs +++ b/src/OpenApiRegistrations.cs @@ -36,25 +36,54 @@ public static IServiceCollection Describe(this IServiceCollection services) { services.ConfigureSwaggerGen(options => { -#if NET7_0_OR_GREATER + // #if NET7_0_OR_GREATER options.SchemaGeneratorOptions.CustomTypeMappings[typeof(T)] = () => new OpenApiSchema { Type = "string", - Pattern = T.RegexString, - Format = T.Name, - Description = T.Description, - Example = new OpenApiString(T.ExampleValue.ToString()), + Pattern = + typeof(T) + .GetRuntimeProperty(nameof(RegexValueObject.RegexString)) + .GetValue(null) as string, + Format = + typeof(T).GetRuntimeProperty(nameof(RegexValueObject.Name)).GetValue(null) + as string, + Description = + typeof(T) + .GetRuntimeProperty(nameof(RegexValueObject.Description)) + .GetValue(null) as string, + Example = new OpenApiString( + typeof(T) + .GetRuntimeProperty(nameof(RegexValueObject.ExampleValue)) + .GetValue(null) + ?.ToString() + ), ExternalDocs = - T.ExternalDocumentation != null + typeof(T) + .GetRuntimeProperty(nameof(RegexValueObject.ExternalDocumentation)) + .GetValue(null) != null ? new OpenApiExternalDocs { - Description = T.ExternalDocumentation?.Description, - Url = T.ExternalDocumentation?.Url + Description = ( + (ExternalDocsTuple?) + typeof(T) + .GetRuntimeProperty( + nameof(RegexValueObject.ExternalDocumentation) + ) + .GetValue(null) + )?.Description, + Url = ( + (ExternalDocsTuple?) + typeof(T) + .GetRuntimeProperty( + nameof(RegexValueObject.ExternalDocumentation) + ) + .GetValue(null) + )?.Url } : null }; -#else + // #else throw new PlatformNotSupportedException( "This feature is not supported by this framework. Upgrade to .NET 7.0 or higher to use it." ); @@ -66,7 +95,7 @@ public static IServiceCollection Describe(this IServiceCollection services) // Description = typeof(T).GetRuntimeProperty(nameof(IRegexValueObject.Description)).GetValue(null) as string, // Example = new OpenApiString(typeof(T).GetRuntimeProperty(nameof(IRegexValueObject.ExampleValue)).GetValue(null).ToString()) // }; -#endif + // #endif }); return services; } diff --git a/src/PRE_NET6_0_POLYFILLS/DateOnly.cs b/src/PRE_NET6_0_POLYFILLS/DateOnly.cs deleted file mode 100644 index 45852fe..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DateOnly.cs +++ /dev/null @@ -1,372 +0,0 @@ -#if !NET6_0_OR_GREATER -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Numerics; -using System.Runtime.Versioning; -using System.Threading; - -// using DayMonthYearTuple = (int Day, int Month, int Year); - -namespace System; - -/// -/// Represents dates with values ranging from January 1, 0001 Anno Domini (Common Era) through December 31, 9999 A.D. (C.E.) in the Gregorian calendar. -/// -public readonly partial struct DateOnly : IComparable, IComparable, IEquatable //, -//ISpanFormattable, -//ISpanParsable, -//IUtf8SpanFormattable -{ - private readonly int _dayNumber => DayNumberFromDateTime(dt); - private readonly DateTime dt { get; init; } - - // Maps to Jan 1st year 1 - private const int MinDayNumber = 0; - - // Maps to December 31 year 9999. The value calculated from "new DateTime(9999, 12, 31).Ticks / TimeSpan.TicksPerDay" - private const int MaxDayNumber = 3_652_058; - - private static int DayNumberFromDateTime(DateTime dt) => - (int)((ulong)dt.Ticks / TimeSpan.TicksPerDay); - - public DateTime GetEquivalentDateTime() => dt; - - private DateOnly(int dayNumber) - { - Debug.Assert((uint)dayNumber <= MaxDayNumber); - dt = new DateTime(dayNumber * TimeSpan.TicksPerDay); - } - - public DateOnly(DateTime date) => dt = date.Date; - - /// - /// Gets the earliest possible date that can be created. - /// - public static readonly DateOnly MinValue = DateTime.MinValue; - - /// - /// Gets the latest possible date that can be created. - /// - public static readonly DateOnly MaxValue = DateTime.MaxValue; - - public static implicit operator DateOnly(DateTime date) => new DateOnly(date); - - public static implicit operator DateTime(DateOnly date) => date.dt; - - /// - /// Creates a new instance of the DateOnly structure to the specified year, month, and day. - /// - /// The year (1 through 9999). - /// The month (1 through 12). - /// The day (1 through the number of days in ). - public DateOnly(int year, int month, int day) => dt = new DateTime(year, month, day); - - /// - /// Creates a new instance of the DateOnly structure to the specified year, month, and day for the specified calendar. - /// - /// The year (1 through the number of years in calendar). - /// The month (1 through the number of months in calendar). - /// The day (1 through the number of days in ). - /// The calendar that is used to interpret year, month, and day.. - public DateOnly(int year, int month, int day, Calendar calendar) => - dt = new DateTime(year, month, day, calendar); - - /// - /// Creates a new instance of the DateOnly structure to the specified number of days. - /// - /// The number of days since January 1, 0001 in the Proleptic Gregorian calendar. - public static DateOnly FromDayNumber(int dayNumber) - { - if ((uint)dayNumber > MaxDayNumber) - { - ThrowHelper.ThrowArgumentOutOfRange_DayNumber(dayNumber); - } - - return new DateOnly(dayNumber); - } - - /// - /// Gets the year component of the date represented by this instance. - /// - public int Year => GetEquivalentDateTime().Year; - - /// - /// Gets the month component of the date represented by this instance. - /// - public int Month => GetEquivalentDateTime().Month; - - /// - /// Gets the day component of the date represented by this instance. - /// - public int Day => GetEquivalentDateTime().Day; - - /// - /// Gets the day of the week represented by this instance. - /// - public DayOfWeek DayOfWeek => GetEquivalentDateTime().DayOfWeek; - - /// - /// Gets the day of the year represented by this instance. - /// - public int DayOfYear => GetEquivalentDateTime().DayOfYear; - - /// - /// Gets the number of days since January 1, 0001 in the Proleptic Gregorian calendar represented by this instance. - /// - public int DayNumber => _dayNumber; - - /// - /// Adds the specified number of days to the value of this instance. - /// - /// The number of days to add. To subtract days, specify a negative number. - /// An instance whose value is the sum of the date represented by this instance and the number of days represented by value. - public DateOnly AddDays(int value) - { - return dt.AddDays(value); - } - - /// - /// Adds the specified number of months to the value of this instance. - /// - /// A number of months. The months parameter can be negative or positive. - /// An object whose value is the sum of the date represented by this instance and months. - public DateOnly AddMonths(int value) => new DateOnly(GetEquivalentDateTime().AddMonths(value)); - - /// - /// Adds the specified number of years to the value of this instance. - /// - /// A number of years. The value parameter can be negative or positive. - /// An object whose value is the sum of the date represented by this instance and the number of years represented by value. - public DateOnly AddYears(int value) => new DateOnly(GetEquivalentDateTime().AddYears(value)); - - /// - /// Determines whether two specified instances of DateOnly are equal. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left and right represent the same date; otherwise, false. - public static bool operator ==(DateOnly left, DateOnly right) => - left._dayNumber == right._dayNumber; - - /// - /// Determines whether two specified instances of DateOnly are not equal. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left and right do not represent the same date; otherwise, false. - public static bool operator !=(DateOnly left, DateOnly right) => - left._dayNumber != right._dayNumber; - - /// - /// Determines whether one specified DateOnly is later than another specified DateTime. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left is later than right; otherwise, false. - public static bool operator >(DateOnly left, DateOnly right) => - left._dayNumber > right._dayNumber; - - /// - /// Determines whether one specified DateOnly represents a date that is the same as or later than another specified DateOnly. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left is the same as or later than right; otherwise, false. - public static bool operator >=(DateOnly left, DateOnly right) => - left._dayNumber >= right._dayNumber; - - /// - /// Determines whether one specified DateOnly is earlier than another specified DateOnly. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left is earlier than right; otherwise, false. - public static bool operator <(DateOnly left, DateOnly right) => - left._dayNumber < right._dayNumber; - - /// - /// Determines whether one specified DateOnly represents a date that is the same as or earlier than another specified DateOnly. - /// - /// The first object to compare. - /// The second object to compare. - /// true if left is the same as or earlier than right; otherwise, false. - public static bool operator <=(DateOnly left, DateOnly right) => - left._dayNumber <= right._dayNumber; - - /// - /// Deconstructs by , and . - /// - /// - /// Deconstructed parameter for . - /// - /// - /// Deconstructed parameter for . - /// - /// - /// Deconstructed parameter for . - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public void Deconstruct(out int year, out int month, out int day) - { - (day, month, year) = Deconstruct(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public DayMonthYearTuple Deconstruct() => - (GetEquivalentDateTime().Day, GetEquivalentDateTime().Month, GetEquivalentDateTime().Year); - - /// - /// Returns a DateTime that is set to the date of this DateOnly instance and the time of specified input time. - /// - /// The time of the day. - /// The DateTime instance composed of the date of the current DateOnly instance and the time specified by the input time. - public DateTime ToDateTime(TimeOnly time) => - dt.AddHours(time.Hour) - .AddMinutes(time.Minute) - .AddSeconds(time.Second) - .AddMilliseconds(time.Millisecond) - .AddMicroseconds(time.Microsecond); - - /// - /// Returns a DateTime instance with the specified input kind that is set to the date of this DateOnly instance and the time of specified input time. - /// - /// The time of the day. - /// One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. - /// The DateTime instance composed of the date of the current DateOnly instance and the time specified by the input time. - public DateTime ToDateTime(TimeOnly time, DateTimeKind kind) => - dt.AddHours(time.Hour) - .AddMinutes(time.Minute) - .AddSeconds(time.Second) - .AddMilliseconds(time.Millisecond) - .AddMicroseconds(time.Microsecond) - .OfKind(kind); - - /// - /// Returns a DateOnly instance that is set to the date part of the specified dateTime. - /// - /// The DateTime instance. - /// The DateOnly instance composed of the date part of the specified input time dateTime instance. - public static DateOnly FromDateTime(DateTime dateTime) => dateTime; - - /// - /// Compares the value of this instance to a specified DateOnly value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value. - /// - /// The object to compare to the current instance. - /// Less than zero if this instance is earlier than value. Greater than zero if this instance is later than value. Zero if this instance is the same as value. - public int CompareTo(DateOnly value) => _dayNumber.CompareTo(value._dayNumber); - - /// - /// Compares the value of this instance to a specified object that contains a specified DateOnly value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateOnly value. - /// - /// A boxed object to compare, or null. - /// Less than zero if this instance is earlier than value. Greater than zero if this instance is later than value. Zero if this instance is the same as value. - public int CompareTo(object? value) - { - if (value == null) - return 1; - if (value is not DateOnly dateOnly) - { - throw new ArgumentException( - $"The argument '{value}' was not recognized as a valid {nameof(DateOnly)}.", - nameof(value) - ); - } - - return CompareTo(dateOnly); - } - - /// - /// Returns a value indicating whether the value of this instance is equal to the value of the specified DateOnly instance. - /// - /// The object to compare to this instance. - /// true if the value parameter equals the value of this instance; otherwise, false. - public bool Equals(DateOnly value) => _dayNumber == value._dayNumber; - - /// - /// Returns a value indicating whether this instance is equal to a specified object. - /// - /// The object to compare to this instance. - /// true if value is an instance of DateOnly and equals the value of this instance; otherwise, false. - public override bool Equals(object? value) => - value is DateOnly dateOnly && _dayNumber == dateOnly._dayNumber; - - /// - /// Returns the hash code for this instance. - /// - /// A 32-bit signed integer hash code. - public override int GetHashCode() => _dayNumber; - - private const string OFormat = "yyyy'-'MM'-'dd"; - private const string RFormat = "ddd, dd MMM yyyy"; - - /// - /// Converts the value of the current DateOnly object to its equivalent long date string representation. - /// - /// A string that contains the long date string representation of the current DateOnly object. - public string ToLongDateString() => ToString("D"); - - /// - /// Converts the value of the current DateOnly object to its equivalent short date string representation. - /// - /// A string that contains the short date string representation of the current DateOnly object. - public string ToShortDateString() => ToString(); - - /// - /// Converts the value of the current DateOnly object to its equivalent string representation using the formatting conventions of the current culture. - /// The DateOnly object will be formatted in short form. - /// - /// A string that contains the short date string representation of the current DateOnly object. - public override string ToString() => ToString("d"); - - /// - /// Converts the value of the current DateOnly object to its equivalent string representation using the specified format and the formatting conventions of the current culture. - /// - /// A standard or custom date format string. - /// An object that supplies culture-specific formatting information. - /// A string representation of value of the current DateOnly object as specified by format. - public string ToString(string? format, IFormatProvider? provider = null) => - ToString(format, provider); - - /// - /// Converts the value of the current DateOnly object to its equivalent string representation using the specified culture-specific format information. - /// - /// An object that supplies culture-specific formatting information. - /// A string representation of value of the current DateOnly object as specified by provider. - public string ToString(IFormatProvider? provider) => ToString("d", provider); - - public static DateOnly Parse(string s) => Parse(s, null as IFormatProvider); - - public static DateOnly Parse(string s, IFormatProvider? provider) - { - if (s == null) - throw new ArgumentNullException(nameof(s)); - return DateTime.ParseExact(s, null, provider).Date; - } - - public static DateOnly Parse(string s, string format) => - DateTime.ParseExact(s, format, null).Date; -} - -public static class DateTimeExtensions -{ - public static DateTime AddMicroseconds(this DateTime dateTime, int microseconds) - { - return checked(dateTime.AddTicks(TimeSpan.FromTicks(microseconds * 10).Ticks)); - } - - public static DateTime OfKind(this DateTime dateTime, DateTimeKind kind) => - kind switch - { - DateTimeKind.Unspecified => DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified), - DateTimeKind.Utc => dateTime.ToUniversalTime(), - DateTimeKind.Local => dateTime.ToLocalTime(), - _ => dateTime - }; -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/DateOnly2.cs b/src/PRE_NET6_0_POLYFILLS/DateOnly2.cs deleted file mode 100644 index 457ae6d..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DateOnly2.cs +++ /dev/null @@ -1,411 +0,0 @@ -/* - * DateOnly2.cs - * - * Created: 2023-07-22-11:50:25 - * Modified: 2023-09-03-01:38:05 - * - * Author: David G. Moore, Jr. - * - * Copyright © 2022 - 2023 David G. Moore, Jr., All Rights Reserved - * License: MIT (https://opensource.org/licenses/MIT) - */ - -#if !NET6_0_OR_GREATER - -namespace System; - -using System; -using System.Diagnostics.Contracts; -using System.Runtime.CompilerServices; -using System.Security.Cryptography; -using System.Text; - -/// -/// Represents a date without a time component. -/// -public readonly partial struct DateOnly : IComparable, IComparable, IEquatable //, ISpanFormattable, IUtf8SpanFormattable -{ - // ... - - // /// - // /// Compares the current instance with an object or DateOnly and returns an indication of their relative values. - // /// - // /// The object or DateOnly to compare with this instance. - // /// A value that indicates the relative order of the objects being compared. - // public int CompareTo(object obj) - // { - // if (obj is null) - // { - // return 1; - // } - - // if (obj is DateOnly other) - // { - // return CompareTo(other); - // } - - // throw new ArgumentException("Object must be of type DateOnly."); - // } - - // /// - // /// Compares the current instance with another DateOnly and returns an indication of their relative values. - // /// - // /// The DateOnly to compare with this instance. - // /// A value that indicates the relative order of the objects being compared. - // // public int CompareTo(DateOnly other) - // // { - // // return _dayNumber.CompareTo(other._dayNumber); - // // } - // /// - // /// Indicates whether the current DateOnly is equal to another DateOnly. - // /// - // /// A DateOnly to compare with this instance. - // /// True if the current instance is equal to the other parameter; otherwise, false. - // public bool Equals(DateOnly other) - // { - // return _dayNumber == other._dayNumber; - // } - - /// - /// Tries to format the DateOnly into a char span using the specified format and format provider. - /// - /// The destination span where the formatted characters will be written to. - /// The number of characters written to the destination span. - /// The format string used to format the DateOnly (optional). - /// The provider used to format the DateOnly (optional). - /// True if the formatting is successful; otherwise, false. - public bool TryFormat( - Span destination, - out int charsWritten, - ReadOnlySpan format = default, - IFormatProvider? formatProvider = null - ) - { - if (format.IsEmpty || format.SequenceEqual("d".AsSpan())) - { - var result = dt.TryFormat(destination, out charsWritten, formatProvider); - return result; - } - if (format.SequenceEqual("D".AsSpan())) - { - return dt.ToString("D", formatProvider) - .AsSpan() - .TryCopyTo(destination, out charsWritten); - } - if (format.SequenceEqual("O".AsSpan())) - { - return dt.ToString("yyyy-MM-dd", formatProvider) - .AsSpan() - .TryCopyTo(destination, out charsWritten); - } - if (format.SequenceEqual("R".AsSpan())) - { - return dt.ToString("ddd, dd MMM yyyy", formatProvider) - .AsSpan() - .TryCopyTo(destination, out charsWritten); - } - - charsWritten = 0; - return false; - } - - /// - /// Tries to format the DateOnly into a UTF-8 byte span using the specified format and format provider. - /// - /// The destination span where the formatted bytes will be written to. - /// The number of bytes written to the destination span. - /// The format string used to format the DateOnly (optional). - /// The provider used to format the DateOnly (optional). - /// True if the formatting is successful; otherwise, false. - public bool TryFormatUtf8( - Span destination, - out int bytesWritten, - ReadOnlySpan format = default, - IFormatProvider? formatProvider = null - ) - { - if (format.IsEmpty || format.SequenceEqual(Encoding.UTF8.GetBytes("d"))) - { - var result = dt.TryFormatUtf8(destination, out bytesWritten, formatProvider); - return result; - } - else if (format.SequenceEqual(Encoding.UTF8.GetBytes("D"))) - { - return Encoding.UTF8 - .GetBytes(dt.ToString("D", formatProvider)) - .AsSpan() - .TryCopyTo(destination, out bytesWritten); - } - else if (format.SequenceEqual(Encoding.UTF8.GetBytes("O"))) - { - return Encoding.UTF8 - .GetBytes(dt.ToString("yyyy-MM-dd", formatProvider)) - .AsSpan() - .TryCopyTo(destination, out bytesWritten); - } - else if (format.SequenceEqual(Encoding.UTF8.GetBytes("R"))) - { - return Encoding.UTF8 - .GetBytes(dt.ToString("ddd, dd MMM yyyy", formatProvider)) - .AsSpan() - .TryCopyTo(destination, out bytesWritten); - } - - bytesWritten = 0; - return false; - } -} - -internal static class DateOnlyExtensions -{ - internal static bool TryFormat( - this DateTime dt, - Span destination, - out int charsWritten, - IFormatProvider? formatProvider = null - ) - { - var result = dt.TryFormat(destination, out charsWritten, formatProvider); - return result; - } - - internal static bool TryFormatUtf8( - this DateTime dt, - Span destination, - out int bytesWritten, - IFormatProvider? formatProvider = null - ) - { - var result = dt.TryFormatUtf8(destination, out bytesWritten, formatProvider); - return result; - } -} - -public static class SpanHelpers -{ - public static unsafe bool TryCopyTo( - this ReadOnlySpan @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - @from.CopyTo(destination); - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this ReadOnlySpan @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (char* pFrom = @from) - fixed (byte* pDest = destination) - { - var pFromByte = (byte*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this ReadOnlySpan @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (byte* pFrom = @from) - fixed (char* pDest = destination) - { - var pFromByte = (char*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this ReadOnlySpan @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (char* pFrom = @from) - fixed (char* pDest = destination) - { - var pFromByte = (char*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this ReadOnlySpan @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (byte* pFrom = @from) - fixed (byte* pDest = destination) - { - var pFromByte = (byte*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this Span @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (char* pFrom = @from) - fixed (byte* pDest = destination) - { - var pFromByte = (byte*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this Span @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (byte* pFrom = @from) - fixed (char* pDest = destination) - { - var pFromByte = (char*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this Span @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (char* pFrom = @from) - fixed (char* pDest = destination) - { - var pFromByte = (char*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static unsafe bool TryCopyTo( - this Span @from, - Span destination, - out int bytesWritten - ) - { - if (from.Length <= destination.Length) - { - bytesWritten = from.Length; - fixed (byte* pFrom = @from) - fixed (byte* pDest = destination) - { - var pFromByte = (byte*)pFrom; - for (int i = 0; i < bytesWritten; i++) - { - pDest[i] = pFromByte[i]; - } - } - return true; - } - - bytesWritten = 0; - return false; - } - - public static void CopyTo(this ReadOnlySpan @from, Span destination) - { - for (var i = 0; i < from.Length; i++) - { - destination[i] = from[i]; - } - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/DisallowNullAttribute.cs b/src/PRE_NET6_0_POLYFILLS/DisallowNullAttribute.cs deleted file mode 100644 index d011f46..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DisallowNullAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -#if !NET6_0_OR_GREATER -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage( - AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, - Inherited = false -)] -public sealed class DisallowNullAttribute : Attribute { } -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/DoesNotReturnAttribute.cs b/src/PRE_NET6_0_POLYFILLS/DoesNotReturnAttribute.cs deleted file mode 100644 index bda3b8e..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DoesNotReturnAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -#if !NETSTANDARD2_1_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage(AttributeTargets.Method, Inherited = false)] -public sealed class DoesNotReturnAttribute : Attribute { } -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMemberTypes.cs b/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMemberTypes.cs deleted file mode 100644 index 056a2e2..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMemberTypes.cs +++ /dev/null @@ -1,29 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Diagnostics.CodeAnalysis; - -[Flags] -public 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, - All = -1 -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMembersAttribute.cs b/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMembersAttribute.cs deleted file mode 100644 index f4cd5aa..0000000 --- a/src/PRE_NET6_0_POLYFILLS/DynamicallyAccessedMembersAttribute.cs +++ /dev/null @@ -1,30 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage( - AttributeTargets.Class - | AttributeTargets.Struct - | AttributeTargets.Method - | AttributeTargets.Property - | AttributeTargets.Field - | AttributeTargets.Interface - | AttributeTargets.Parameter - | AttributeTargets.ReturnValue - | AttributeTargets.GenericParameter, - Inherited = false -)] -public sealed class DynamicallyAccessedMembersAttribute : Attribute -{ - public DynamicallyAccessedMemberTypes MemberTypes { get; } - - public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes) - { - MemberTypes = memberTypes; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ExceptionArgument.cs b/src/PRE_NET6_0_POLYFILLS/ExceptionArgument.cs deleted file mode 100644 index e27d1ad..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ExceptionArgument.cs +++ /dev/null @@ -1,111 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System; - -internal enum ExceptionArgument -{ - obj, - dictionary, - array, - info, - key, - text, - values, - value, - startIndex, - task, - bytes, - byteIndex, - byteCount, - ch, - chars, - charIndex, - charCount, - s, - input, - ownedMemory, - list, - index, - capacity, - collection, - item, - converter, - match, - count, - action, - comparison, - exceptions, - exception, - pointer, - start, - format, - formats, - culture, - comparer, - comparable, - source, - length, - comparisonType, - manager, - sourceBytesToCopy, - callBack, - creationOptions, - function, - scheduler, - continuation, - continuationAction, - continuationFunction, - tasks, - asyncResult, - beginMethod, - endMethod, - endFunction, - cancellationToken, - continuationOptions, - delay, - millisecondsDelay, - millisecondsTimeout, - stateMachine, - timeout, - type, - sourceIndex, - sourceArray, - destinationIndex, - destinationArray, - pHandle, - handle, - other, - newSize, - lowerBounds, - lengths, - len, - keys, - indices, - index1, - index2, - index3, - length1, - length2, - length3, - endIndex, - elementType, - arrayIndex, - year, - codePoint, - str, - options, - prefix, - suffix, - buffer, - buffers, - offset, - stream, - anyOf, - overlapped, - minimumBytes -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ExceptionResource.cs b/src/PRE_NET6_0_POLYFILLS/ExceptionResource.cs deleted file mode 100644 index c289a35..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ExceptionResource.cs +++ /dev/null @@ -1,90 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System; - -internal enum ExceptionResource -{ - ArgumentOutOfRange_IndexMustBeLessOrEqual, - ArgumentOutOfRange_IndexMustBeLess, - ArgumentOutOfRange_IndexCount, - ArgumentOutOfRange_IndexCountBuffer, - ArgumentOutOfRange_Count, - ArgumentOutOfRange_Year, - Arg_ArrayPlusOffTooSmall, - Arg_ByteArrayTooSmallForValue, - NotSupported_ReadOnlyCollection, - Arg_RankMultiDimNotSupported, - Arg_NonZeroLowerBound, - ArgumentOutOfRange_GetCharCountOverflow, - ArgumentOutOfRange_ListInsert, - ArgumentOutOfRange_NeedNonNegNum, - ArgumentOutOfRange_NotGreaterThanBufferLength, - ArgumentOutOfRange_SmallCapacity, - Argument_InvalidOffLen, - Argument_CannotExtractScalar, - ArgumentOutOfRange_BiggerThanCollection, - Serialization_MissingKeys, - Serialization_NullKey, - NotSupported_KeyCollectionSet, - NotSupported_ValueCollectionSet, - InvalidOperation_NullArray, - TaskT_TransitionToFinal_AlreadyCompleted, - TaskCompletionSourceT_TrySetException_NullException, - TaskCompletionSourceT_TrySetException_NoExceptions, - NotSupported_StringComparison, - ConcurrentCollection_SyncRoot_NotSupported, - Task_MultiTaskContinuation_NullTask, - InvalidOperation_WrongAsyncResultOrEndCalledMultiple, - Task_MultiTaskContinuation_EmptyTaskList, - Task_Start_TaskCompleted, - Task_Start_Promise, - Task_Start_ContinuationTask, - Task_Start_AlreadyStarted, - Task_RunSynchronously_Continuation, - Task_RunSynchronously_Promise, - Task_RunSynchronously_TaskCompleted, - Task_RunSynchronously_AlreadyStarted, - AsyncMethodBuilder_InstanceNotInitialized, - Task_ContinueWith_ESandLR, - Task_ContinueWith_NotOnAnything, - Task_InvalidTimerTimeSpan, - Task_Delay_InvalidMillisecondsDelay, - Task_Dispose_NotCompleted, - Task_ThrowIfDisposed, - Task_WaitMulti_NullTask, - ArgumentException_OtherNotArrayOfCorrectLength, - ArgumentNull_Array, - ArgumentNull_SafeHandle, - ArgumentOutOfRange_EndIndexStartIndex, - ArgumentOutOfRange_Enum, - ArgumentOutOfRange_HugeArrayNotSupported, - Argument_AddingDuplicate, - Argument_InvalidArgumentForComparison, - Arg_LowerBoundsMustMatch, - Arg_MustBeType, - Arg_Need1DArray, - Arg_Need2DArray, - Arg_Need3DArray, - Arg_NeedAtLeast1Rank, - Arg_RankIndices, - Arg_RanksAndBounds, - InvalidOperation_IComparerFailed, - NotSupported_FixedSizeCollection, - Rank_MultiDimNotSupported, - Arg_TypeNotSupported, - Argument_SpansMustHaveSameLength, - Argument_InvalidFlag, - CancellationTokenSource_Disposed, - Argument_AlignmentMustBePow2, - InvalidOperation_SpanOverlappedOperation, - InvalidOperation_TimeProviderNullLocalTimeZone, - InvalidOperation_TimeProviderInvalidTimestampFrequency, - Format_UnexpectedClosingBrace, - Format_UnclosedFormatItem, - Format_ExpectedAsciiDigit -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/FastResourceComparer.cs b/src/PRE_NET6_0_POLYFILLS/FastResourceComparer.cs deleted file mode 100644 index df5d1ec..0000000 --- a/src/PRE_NET6_0_POLYFILLS/FastResourceComparer.cs +++ /dev/null @@ -1,134 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; - -namespace System.Resources; - -internal sealed class FastResourceComparer - : IComparer, - IEqualityComparer, - IComparer, - IEqualityComparer -{ - internal static readonly FastResourceComparer Default = new FastResourceComparer(); - - public int GetHashCode(object key) - { - string key2 = (string)key; - return HashFunction(key2); - } - - public int GetHashCode([DisallowNull] string key) - { - return HashFunction(key); - } - - internal static int HashFunction(string key) - { - uint num = 5381u; - for (int i = 0; i < key.Length; i++) - { - num = ((num << 5) + num) ^ key[i]; - } - return (int)num; - } - - public int Compare(object a, object b) - { - if (a == b) - { - return 0; - } - string strA = (string)a; - string strB = (string)b; - return string.CompareOrdinal(strA, strB); - } - - public int Compare(string a, string b) - { - return string.CompareOrdinal(a, b); - } - - public bool Equals(string a, string b) - { - return string.Equals(a, b); - } - - public new bool Equals(object a, object b) - { - if (a == b) - { - return true; - } - string a2 = (string)a; - string b2 = (string)b; - return string.Equals(a2, b2); - } - - public static unsafe int CompareOrdinal(string a, byte[] bytes, int bCharLength) - { - int num = 0; - int num2 = 0; - int num3 = a.Length; - if (num3 > bCharLength) - { - num3 = bCharLength; - } - if (bCharLength == 0) - { - if (a.Length != 0) - { - return -1; - } - return 0; - } - fixed (byte* ptr = bytes) - { - byte* ptr2 = ptr; - while (num < num3 && num2 == 0) - { - int num4 = *ptr2 | (ptr2[1] << 8); - num2 = a[num++] - num4; - ptr2 += 2; - } - } - if (num2 != 0) - { - return num2; - } - return a.Length - bCharLength; - } - - public static int CompareOrdinal(byte[] bytes, int aCharLength, string b) - { - return -CompareOrdinal(b, bytes, aCharLength); - } - - internal static unsafe int CompareOrdinal(byte* a, int byteLen, string b) - { - int num = 0; - int num2 = 0; - int num3 = byteLen >> 1; - if (num3 > b.Length) - { - num3 = b.Length; - } - while (num2 < num3 && num == 0) - { - char c = (char)(*(a++) | (*(a++) << 8)); - num = c - b[num2++]; - } - if (num != 0) - { - return num; - } - return byteLen - b.Length * 2; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/MemberNotNullAttribute.cs b/src/PRE_NET6_0_POLYFILLS/MemberNotNullAttribute.cs deleted file mode 100644 index 05e1c91..0000000 --- a/src/PRE_NET6_0_POLYFILLS/MemberNotNullAttribute.cs +++ /dev/null @@ -1,29 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion -#pragma warning disable CS0436 -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage( - AttributeTargets.Method | AttributeTargets.Property, - Inherited = false, - AllowMultiple = true -)] -public sealed class MemberNotNullAttribute : Attribute -{ - public string[] Members { get; } - - public MemberNotNullAttribute(string member) - { - Members = new string[1] { member }; - } - - public MemberNotNullAttribute(params string[] members) - { - Members = members; - } -} -#endif -#pragma warning restore CS0436 diff --git a/src/PRE_NET6_0_POLYFILLS/RequiresDynamicCodeAttribute.cs b/src/PRE_NET6_0_POLYFILLS/RequiresDynamicCodeAttribute.cs deleted file mode 100644 index 91704af..0000000 --- a/src/PRE_NET6_0_POLYFILLS/RequiresDynamicCodeAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage( - AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, - Inherited = false -)] -public sealed class RequiresDynamicCodeAttribute : Attribute -{ - public string Message { get; } - - public string? Url { get; set; } - - public RequiresDynamicCodeAttribute(string message) - { - Message = message; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/RequiresUnreferencedCode.cs b/src/PRE_NET6_0_POLYFILLS/RequiresUnreferencedCode.cs deleted file mode 100644 index cdfdff6..0000000 --- a/src/PRE_NET6_0_POLYFILLS/RequiresUnreferencedCode.cs +++ /dev/null @@ -1,24 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Diagnostics.CodeAnalysis; - -[AttributeUsage( - AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, - Inherited = false -)] -public sealed class RequiresUnreferencedCodeAttribute : Attribute -{ - public string Message { get; } - - public string? Url { get; set; } - - public RequiresUnreferencedCodeAttribute(string message) - { - Message = message; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ResourceLocator.cs b/src/PRE_NET6_0_POLYFILLS/ResourceLocator.cs deleted file mode 100644 index 931fba2..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ResourceLocator.cs +++ /dev/null @@ -1,26 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Resources; - -internal readonly struct ResourceLocator -{ - internal int DataPosition { get; } - - internal object? Value { get; } - - internal ResourceLocator(int dataPos, object? value) - { - DataPosition = dataPos; - Value = value; - } - - internal static bool CanCache(ResourceTypeCode value) - { - return value <= ResourceTypeCode.TimeSpan; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ResourceReader.cs b/src/PRE_NET6_0_POLYFILLS/ResourceReader.cs deleted file mode 100644 index df74a2b..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ResourceReader.cs +++ /dev/null @@ -1,1155 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -using System.Buffers.Binary; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Reflection; -using System.Text; -using System.Threading; - -namespace System.Resources; - -internal sealed class _ResourceReader : IResourceReader, IEnumerable, IDisposable -{ - internal sealed class ResourceEnumerator : IDictionaryEnumerator, IEnumerator - { - private readonly _ResourceReader _reader; - - private bool _currentIsValid; - - private int _currentName; - - private int _dataPosition; - - public object Key - { - get - { - if (_currentName == int.MinValue) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); - } - if (!_currentIsValid) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); - } - if (_reader._resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - return _reader.AllocateStringForNameIndex(_currentName, out _dataPosition); - } - } - - public object Current => Entry; - - internal int DataPosition => _dataPosition; - - public DictionaryEntry Entry - { - get - { - if (_currentName == int.MinValue) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); - } - if (!_currentIsValid) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); - } - if (_reader._resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - string? key = _reader.AllocateStringForNameIndex(_currentName, out _dataPosition); - object? obj = null; - lock (_reader._resCache) - { - if (_reader._resCache.TryGetValue(key, out var value)) - { - obj = value.Value; - } - } - if (obj == null) - { - obj = ( - (_dataPosition != -1) - ? _reader.LoadObject(_dataPosition) - : _reader.GetValueForNameIndex(_currentName) - ); - } - return new DictionaryEntry(key, obj); - } - } - - public object? Value - { - get - { - if (_currentName == int.MinValue) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); - } - if (!_currentIsValid) - { - throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); - } - if (_reader._resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - return _reader.GetValueForNameIndex(_currentName); - } - } - - internal ResourceEnumerator(_ResourceReader reader) - { - _currentName = -1; - _reader = reader; - _dataPosition = -2; - } - - public bool MoveNext() - { - if (_currentName == _reader._numResources - 1 || _currentName == int.MinValue) - { - _currentIsValid = false; - _currentName = int.MinValue; - return false; - } - _currentIsValid = true; - _currentName++; - return true; - } - - public void Reset() - { - if (_reader._resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - _currentIsValid = false; - _currentName = -1; - } - } - - private readonly bool _permitDeserialization; - - private object _binaryFormatter; - - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] - private static Type s_binaryFormatterType; - - private static Func s_deserializeMethod; - - private BinaryReader? _store; - - internal Dictionary? _resCache; - - private long _nameSectionOffset; - - private long _dataSectionOffset; - - private int[]? _nameHashes; - - private unsafe int* _nameHashesPtr; - - private int[]? _namePositions; - - private unsafe int* _namePositionsPtr; - - private Type[]? _typeTable; - - private int[]? _typeNamePositions; - - private int _numResources; - - private UnmanagedMemoryStream? _ums; - - private int _version; - - internal static bool AllowCustomResourceTypes { get; } = - !AppContext.TryGetSwitch( - "System.Resources.ResourceManager.AllowCustomResourceTypes", - out var isEnabled - ) || isEnabled; - - internal _ResourceReader( - Stream stream, - Dictionary resCache, - bool permitDeserialization - ) - { - _resCache = resCache; - _store = new BinaryReader(stream, Encoding.UTF8); - _ums = stream as UnmanagedMemoryStream; - _permitDeserialization = permitDeserialization; - ReadResources(); - } - - private object DeserializeObject(int typeIndex) - { - if (!AllowCustomResourceTypes) - { - throw new NotSupportedException(SR.ResourceManager_ReflectionNotAllowed); - } - if (!_permitDeserialization) - { - throw new NotSupportedException(SR.NotSupported_ResourceObjectSerialization); - } - if (Volatile.Read(ref _binaryFormatter) == null && !InitializeBinaryFormatter()) - { - throw new NotSupportedException(SR.BinaryFormatter_SerializationDisallowed); - } - Type type = FindType(typeIndex); - object obj = s_deserializeMethod(_binaryFormatter, _store.BaseStream); - if (obj.GetType() != type) - { - throw new BadImageFormatException( - SR.Format( - SR.BadImageFormat_ResType_SerBlobMismatch, - type.FullName, - obj.GetType().FullName - ) - ); - } - return obj; - } - - [RequiresDynamicCode( - "The native code for this instantiation might not be available at runtime." - )] - [RequiresUnreferencedCode( - "The CustomResourceTypesSupport feature switch has been enabled for this app which is being trimmed. Custom readers as well as custom objects on the resources file are not observable by the trimmer and so required assemblies, types and members may be removed." - )] - private bool InitializeBinaryFormatter() - { - if ( - (object)Volatile.Read(ref s_binaryFormatterType) == null - || Volatile.Read(ref s_deserializeMethod) == null - ) - { - Type? type = Type.GetType( - "System.Runtime.Serialization.Formatters.Binary.BinaryFormatter, System.Runtime.Serialization.Formatters", - throwOnError: true - ); - MethodInfo? method = type.GetMethod("Deserialize", new Type[1] { typeof(Stream) }); - MethodInfo? method2 = typeof(_ResourceReader)!.GetMethod( - "CreateUntypedDelegate", - BindingFlags.Static | BindingFlags.NonPublic - ); - object? obj; - if ((object)method2 == null) - { - obj = null; - } - else - { - MethodInfo methodInfo = method2!.MakeGenericMethod(type); - object[] parameters = new MethodInfo[1] { method }; - obj = methodInfo.Invoke(null, parameters); - } - Func? value = (Func?)obj; - Interlocked.CompareExchange(ref s_binaryFormatterType, type, null); - Interlocked.CompareExchange(ref s_deserializeMethod, value, null); - } - Volatile.Write(ref _binaryFormatter, Activator.CreateInstance(s_binaryFormatterType)); - return s_deserializeMethod != null; - } - - private static Func CreateUntypedDelegate(MethodInfo method) - { - Func typedDelegate = - (Func) - Delegate.CreateDelegate(typeof(Func), null, method); - return (object obj, Stream stream) => typedDelegate((TInstance)obj, stream); - } - - private static bool ValidateReaderType(string readerType) - { - throw new NotImplementedException(); - // return ResourceManager.IsDefaultType(readerType, "System.Resources.ResourceReader"); - } - - public void GetResourceData( - string resourceName, - out string resourceType, - out byte[] resourceData - ) - { - if (resourceName == null) - { - throw new ArgumentNullException(nameof(resourceName)); - } - if (_resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - int[] array = new int[_numResources]; - int num = FindPosForResource(resourceName); - if (num == -1) - { - throw new ArgumentException(SR.Format(SR.Arg_ResourceNameNotExist, resourceName)); - } - lock (this) - { - for (int i = 0; i < _numResources; i++) - { - _store.BaseStream.Position = _nameSectionOffset + GetNamePosition(i); - int num2 = _store.Read7BitEncodedInt(); - if (num2 < 0) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesNameInvalidOffset, num2) - ); - } - _store.BaseStream.Position += num2; - int num3 = _store.ReadInt32(); - if (num3 < 0 || num3 >= _store.BaseStream.Length - _dataSectionOffset) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, num3) - ); - } - array[i] = num3; - } - Array.Sort(array); - int num4 = Array.BinarySearch(array, num); - long num5 = ( - (num4 < _numResources - 1) - ? (array[num4 + 1] + _dataSectionOffset) - : _store.BaseStream.Length - ); - int num6 = (int)(num5 - (num + _dataSectionOffset)); - _store.BaseStream.Position = _dataSectionOffset + num; - ResourceTypeCode resourceTypeCode = (ResourceTypeCode)_store.Read7BitEncodedInt(); - if ( - resourceTypeCode < ResourceTypeCode.Null - || (int)resourceTypeCode >= 64 + _typeTable.Length - ) - { - throw new BadImageFormatException(SR.BadImageFormat_InvalidType); - } - resourceType = TypeNameFromTypeCode(resourceTypeCode); - num6 -= (int)(_store.BaseStream.Position - (_dataSectionOffset + num)); - byte[] array2 = _store.ReadBytes(num6); - if (array2.Length != num6) - { - throw new FormatException(SR.BadImageFormat_ResourceNameCorrupted); - } - resourceData = array2; - } - } - - public _ResourceReader(string fileName) - { - _resCache = new Dictionary(FastResourceComparer.Default); - _store = new BinaryReader( - new FileStream( - fileName, - FileMode.Open, - FileAccess.Read, - FileShare.Read, - 4096, - FileOptions.RandomAccess - ), - Encoding.UTF8 - ); - try - { - ReadResources(); - } - catch - { - _store.Close(); - throw; - } - } - - public _ResourceReader(Stream stream) - { - if (stream is null) - { - throw new ArgumentNullException(nameof(stream)); - } - if (!stream.CanRead) - { - throw new ArgumentException(SR.Argument_StreamNotReadable); - } - _resCache = new Dictionary(FastResourceComparer.Default); - _store = new BinaryReader(stream, Encoding.UTF8); - _ums = stream as UnmanagedMemoryStream; - ReadResources(); - } - - public void Close() - { - Dispose(disposing: true); - } - - public void Dispose() - { - Close(); - } - - private unsafe void Dispose(bool disposing) - { - if (_store != null) - { - _resCache = null; - if (disposing) - { - BinaryReader store = _store; - _store = null; - store?.Close(); - } - _store = null; - _namePositions = null; - _nameHashes = null; - _ums = null; - _namePositionsPtr = null; - _nameHashesPtr = null; - } - } - - private static unsafe int ReadUnalignedI4(int* p) - { - return BinaryPrimitives.ReadInt32LittleEndian(new ReadOnlySpan(p, 4)); - } - - private void SkipString() - { - int num = _store.Read7BitEncodedInt(); - if (num < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); - } - _store.BaseStream.Seek(num, SeekOrigin.Current); - } - - private unsafe int GetNameHash(int index) - { - if (_ums == null) - { - return _nameHashes[index]; - } - return ReadUnalignedI4(_nameHashesPtr + index); - } - - private unsafe int GetNamePosition(int index) - { - int num = ( - (_ums != null) ? ReadUnalignedI4(_namePositionsPtr + index) : _namePositions[index] - ); - if (num < 0 || num > _dataSectionOffset - _nameSectionOffset) - { - throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesNameInvalidOffset, num)); - } - return num; - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public IDictionaryEnumerator GetEnumerator() - { - if (_resCache == null) - { - throw new InvalidOperationException(SR.ResourceReaderIsClosed); - } - return new ResourceEnumerator(this); - } - - internal ResourceEnumerator GetEnumeratorInternal() - { - return new ResourceEnumerator(this); - } - - internal int FindPosForResource(string name) - { - int num = FastResourceComparer.HashFunction(name); - int num2 = 0; - int i = _numResources - 1; - int num3 = -1; - bool flag = false; - while (num2 <= i) - { - num3 = num2 + i >> 1; - int nameHash = GetNameHash(num3); - int num4 = ((nameHash != num) ? ((nameHash >= num) ? 1 : (-1)) : 0); - if (num4 == 0) - { - flag = true; - break; - } - if (num4 < 0) - { - num2 = num3 + 1; - } - else - { - i = num3 - 1; - } - } - if (!flag) - { - return -1; - } - if (num2 != num3) - { - num2 = num3; - while (num2 > 0 && GetNameHash(num2 - 1) == num) - { - num2--; - } - } - if (i != num3) - { - for (i = num3; i < _numResources - 1 && GetNameHash(i + 1) == num; i++) { } - } - lock (this) - { - for (int j = num2; j <= i; j++) - { - _store.BaseStream.Seek(_nameSectionOffset + GetNamePosition(j), SeekOrigin.Begin); - if (CompareStringEqualsName(name)) - { - int num5 = _store.ReadInt32(); - if (num5 < 0 || num5 >= _store.BaseStream.Length - _dataSectionOffset) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, num5) - ); - } - return num5; - } - } - } - return -1; - } - - private unsafe bool CompareStringEqualsName(string name) - { - int num = _store.Read7BitEncodedInt(); - if (num < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); - } - if (_ums != null) - { - byte* positionPointer = _ums.PositionPointer; - _ums.Seek(num, SeekOrigin.Current); - if (_ums.Position > _ums.Length) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesNameTooLong); - } - return FastResourceComparer.CompareOrdinal(positionPointer, num, name) == 0; - } - byte[] array = new byte[num]; - int num2 = num; - while (num2 > 0) - { - int num3 = _store.Read(array, num - num2, num2); - if (num3 == 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourceNameCorrupted); - } - num2 -= num3; - } - return FastResourceComparer.CompareOrdinal(array, num / 2, name) == 0; - } - - private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) - { - long num = GetNamePosition(index); - int num2; - byte[] array; - lock (this) - { - _store.BaseStream.Seek(num + _nameSectionOffset, SeekOrigin.Begin); - num2 = _store.Read7BitEncodedInt(); - if (num2 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); - } - if (_ums != null) - { - if (_ums.Position > _ums.Length - num2) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index) - ); - } - string? text = null; - char* positionPointer = (char*)_ums.PositionPointer; - _ = BitConverter.IsLittleEndian; - text = new string(positionPointer, 0, num2 / 2); - _ums.Position += num2; - dataOffset = _store.ReadInt32(); - if (dataOffset < 0 || dataOffset >= _store.BaseStream.Length - _dataSectionOffset) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataOffset) - ); - } - return text; - } - array = new byte[num2]; - int num3 = num2; - while (num3 > 0) - { - int num4 = _store.Read(array, num2 - num3, num3); - if (num4 == 0) - { - throw new EndOfStreamException( - SR.Format(SR.BadImageFormat_ResourceNameCorrupted_NameIndex, index) - ); - } - num3 -= num4; - } - dataOffset = _store.ReadInt32(); - if (dataOffset < 0 || dataOffset >= _store.BaseStream.Length - _dataSectionOffset) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataOffset) - ); - } - } - return Encoding.Unicode.GetString(array, 0, num2); - } - - private object? GetValueForNameIndex(int index) - { - long num = GetNamePosition(index); - lock (this) - { - _store.BaseStream.Seek(num + _nameSectionOffset, SeekOrigin.Begin); - SkipString(); - int num2 = _store.ReadInt32(); - if (num2 < 0 || num2 >= _store.BaseStream.Length - _dataSectionOffset) - { - throw new FormatException( - SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, num2) - ); - } - if (_version == 1) - { - return LoadObjectV1(num2); - } - ResourceTypeCode typeCode; - return LoadObjectV2(num2, out typeCode); - } - } - - internal string? LoadString(int pos) - { - lock (this) - { - _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); - string? result = null; - int num = _store.Read7BitEncodedInt(); - if (_version == 1) - { - if (num == -1) - { - return null; - } - if (FindType(num) != typeof(string)) - { - throw new InvalidOperationException( - SR.Format( - SR.InvalidOperation_ResourceNotString_Type, - FindType(num).FullName - ) - ); - } - result = _store.ReadString(); - } - else - { - ResourceTypeCode resourceTypeCode = (ResourceTypeCode)num; - if (resourceTypeCode != ResourceTypeCode.String && resourceTypeCode != 0) - { - throw new InvalidOperationException( - SR.Format( - p1: (resourceTypeCode >= ResourceTypeCode.StartOfUserTypes) - ? FindType((int)(resourceTypeCode - 64)).FullName - : resourceTypeCode.ToString(), - resourceFormat: SR.InvalidOperation_ResourceNotString_Type - ) - ); - } - if (resourceTypeCode == ResourceTypeCode.String) - { - result = _store.ReadString(); - } - } - return result; - } - } - - internal object? LoadObject(int pos) - { - lock (this) - { - ResourceTypeCode typeCode; - return (_version == 1) ? LoadObjectV1(pos) : LoadObjectV2(pos, out typeCode); - } - } - - internal object? LoadObject(int pos, out ResourceTypeCode typeCode) - { - lock (this) - { - if (_version == 1) - { - object? obj = LoadObjectV1(pos); - typeCode = ( - (obj is string) ? ResourceTypeCode.String : ResourceTypeCode.StartOfUserTypes - ); - return obj; - } - return LoadObjectV2(pos, out typeCode); - } - } - - private object? LoadObjectV1(int pos) - { - try - { - return _LoadObjectV1(pos); - } - catch (EndOfStreamException inner) - { - throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, inner); - } - catch (ArgumentOutOfRangeException inner2) - { - throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, inner2); - } - } - - private object? _LoadObjectV1(int pos) - { - _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); - int num = _store.Read7BitEncodedInt(); - if (num == -1) - { - return null; - } - Type type = FindType(num); - if (type == typeof(string)) - { - return _store.ReadString(); - } - if (type == typeof(int)) - { - return _store.ReadInt32(); - } - if (type == typeof(byte)) - { - return _store.ReadByte(); - } - if (type == typeof(sbyte)) - { - return _store.ReadSByte(); - } - if (type == typeof(short)) - { - return _store.ReadInt16(); - } - if (type == typeof(long)) - { - return _store.ReadInt64(); - } - if (type == typeof(ushort)) - { - return _store.ReadUInt16(); - } - if (type == typeof(uint)) - { - return _store.ReadUInt32(); - } - if (type == typeof(ulong)) - { - return _store.ReadUInt64(); - } - if (type == typeof(float)) - { - return _store.ReadSingle(); - } - if (type == typeof(double)) - { - return _store.ReadDouble(); - } - if (type == typeof(DateTime)) - { - return new DateTime(_store.ReadInt64()); - } - if (type == typeof(TimeSpan)) - { - return new TimeSpan(_store.ReadInt64()); - } - if (type == typeof(decimal)) - { - Span span = stackalloc int[4]; - for (int i = 0; i < span.Length; i++) - { - span[i] = _store.ReadInt32(); - } - return _store.ReadDecimal(); - } - return DeserializeObject(num); - } - - private object? LoadObjectV2(int pos, out ResourceTypeCode typeCode) - { - try - { - return _LoadObjectV2(pos, out typeCode); - } - catch (EndOfStreamException inner) - { - throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, inner); - } - catch (ArgumentOutOfRangeException inner2) - { - throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, inner2); - } - } - - private unsafe object? _LoadObjectV2(int pos, out ResourceTypeCode typeCode) - { - _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); - typeCode = (ResourceTypeCode)_store.Read7BitEncodedInt(); - switch (typeCode) - { - case ResourceTypeCode.Null: - return null; - case ResourceTypeCode.String: - return _store.ReadString(); - case ResourceTypeCode.Boolean: - return _store.ReadBoolean(); - case ResourceTypeCode.Char: - return (char)_store.ReadUInt16(); - case ResourceTypeCode.Byte: - return _store.ReadByte(); - case ResourceTypeCode.SByte: - return _store.ReadSByte(); - case ResourceTypeCode.Int16: - return _store.ReadInt16(); - case ResourceTypeCode.UInt16: - return _store.ReadUInt16(); - case ResourceTypeCode.Int32: - return _store.ReadInt32(); - case ResourceTypeCode.UInt32: - return _store.ReadUInt32(); - case ResourceTypeCode.Int64: - return _store.ReadInt64(); - case ResourceTypeCode.UInt64: - return _store.ReadUInt64(); - case ResourceTypeCode.Single: - return _store.ReadSingle(); - case ResourceTypeCode.Double: - return _store.ReadDouble(); - case ResourceTypeCode.Decimal: - return _store.ReadDecimal(); - case ResourceTypeCode.DateTime: - { - long dateData = _store.ReadInt64(); - return DateTime.FromBinary(dateData); - } - case ResourceTypeCode.TimeSpan: - { - long ticks = _store.ReadInt64(); - return new TimeSpan(ticks); - } - case ResourceTypeCode.ByteArray: - { - int num2 = _store.ReadInt32(); - if (num2 < 0) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2) - ); - } - if (_ums == null) - { - if (num2 > _store.BaseStream.Length) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2) - ); - } - return _store.ReadBytes(num2); - } - if (num2 > _ums.Length - _ums.Position) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num2) - ); - } - byte[] array2 = new byte[num2]; - int num3 = _ums.Read(array2, 0, num2); - return array2; - } - case ResourceTypeCode.Stream: - { - int num = _store.ReadInt32(); - if (num < 0) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num) - ); - } - if (_ums == null) - { - byte[] array = _store.ReadBytes(num); - return new MemoryStream(array); - } - if (num > _ums.Length - _ums.Position) - { - throw new BadImageFormatException( - SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, num) - ); - } - return new UnmanagedMemoryStream(_ums.PositionPointer, num, num, FileAccess.Read); - } - default: - { - if (typeCode < ResourceTypeCode.StartOfUserTypes) - { - throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch); - } - int typeIndex = (int)(typeCode - 64); - return DeserializeObject(typeIndex); - } - } - } - - [MemberNotNull("_typeTable")] - [MemberNotNull("_typeNamePositions")] - private void ReadResources() - { - try - { - _ReadResources(); - } - catch (EndOfStreamException inner) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted, inner); - } - catch (IndexOutOfRangeException inner2) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted, inner2); - } - } - - [MemberNotNull("_typeTable")] - [MemberNotNull("_typeNamePositions")] - private unsafe void _ReadResources() - { - int num = _store.ReadInt32(); - if (num != ResourceManager.MagicNumber) - { - throw new ArgumentException(SR.Resources_StreamNotValid); - } - int num2 = _store.ReadInt32(); - int num3 = _store.ReadInt32(); - if (num3 < 0 || num2 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - if (num2 > 1) - { - _store.BaseStream.Seek(num3, SeekOrigin.Current); - } - else - { - string text = _store.ReadString(); - if (!ValidateReaderType(text)) - { - throw new NotSupportedException( - SR.Format(SR.NotSupported_WrongResourceReader_Type, text) - ); - } - SkipString(); - } - int num4 = _store.ReadInt32(); - if (num4 != 2 && num4 != 1) - { - throw new ArgumentException(SR.Format(SR.Arg_ResourceFileUnsupportedVersion, 2, num4)); - } - _version = num4; - _numResources = _store.ReadInt32(); - if (_numResources < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - int num5 = _store.ReadInt32(); - if (num5 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - _typeTable = new Type[num5]; - _typeNamePositions = new int[num5]; - for (int i = 0; i < num5; i++) - { - _typeNamePositions[i] = (int)_store.BaseStream.Position; - SkipString(); - } - long position = _store.BaseStream.Position; - int num6 = (int)position & 7; - if (num6 != 0) - { - for (int j = 0; j < 8 - num6; j++) - { - _store.ReadByte(); - } - } - if (_ums == null) - { - _nameHashes = new int[_numResources]; - for (int k = 0; k < _numResources; k++) - { - _nameHashes[k] = _store.ReadInt32(); - } - } - else - { - int num7 = 4 * _numResources; - if (num7 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - _nameHashesPtr = (int*)_ums.PositionPointer; - _ums.Seek(num7, SeekOrigin.Current); - _ = _ums.PositionPointer; - } - if (_ums == null) - { - _namePositions = new int[_numResources]; - for (int l = 0; l < _numResources; l++) - { - int num8 = _store.ReadInt32(); - if (num8 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - _namePositions[l] = num8; - } - } - else - { - int num9 = 4 * _numResources; - if (num9 < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - _namePositionsPtr = (int*)_ums.PositionPointer; - _ums.Seek(num9, SeekOrigin.Current); - _ = _ums.PositionPointer; - } - _dataSectionOffset = _store.ReadInt32(); - if (_dataSectionOffset < 0) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - _nameSectionOffset = _store.BaseStream.Position; - if (_dataSectionOffset < _nameSectionOffset) - { - throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); - } - } - - private Type FindType(int typeIndex) - { - if (!AllowCustomResourceTypes) - { - throw new NotSupportedException(SR.ResourceManager_ReflectionNotAllowed); - } - if (typeIndex < 0 || typeIndex >= _typeTable.Length) - { - throw new BadImageFormatException(SR.BadImageFormat_InvalidType); - } - return _typeTable[typeIndex] ?? UseReflectionToGetType(typeIndex); - } - - [RequiresUnreferencedCode( - "The CustomResourceTypesSupport feature switch has been enabled for this app which is being trimmed. Custom readers as well as custom objects on the resources file are not observable by the trimmer and so required assemblies, types and members may be removed." - )] - private Type UseReflectionToGetType(int typeIndex) - { - long position = _store.BaseStream.Position; - try - { - _store.BaseStream.Position = _typeNamePositions[typeIndex]; - string typeName = _store.ReadString(); - _typeTable[typeIndex] = Type.GetType(typeName, throwOnError: true); - return _typeTable[typeIndex]; - } - catch (FileNotFoundException innerException) when (!_permitDeserialization) - { - throw new NotSupportedException( - SR.NotSupported_ResourceObjectSerialization, - innerException - ); - } - finally - { - _store.BaseStream.Position = position; - } - } - - private string TypeNameFromTypeCode(ResourceTypeCode typeCode) - { - if (typeCode < ResourceTypeCode.StartOfUserTypes) - { - return "ResourceTypeCode." + typeCode; - } - int num = (int)(typeCode - 64); - long position = _store.BaseStream.Position; - try - { - _store.BaseStream.Position = _typeNamePositions[num]; - return _store.ReadString(); - } - finally - { - _store.BaseStream.Position = position; - } - } -} - -public static class BinaryReaderExtensions -{ - public static int Read7BitEncodedInt(this BinaryReader reader) - { - uint num = 0u; - byte b; - for (int i = 0; i < 28; i += 7) - { - b = reader.ReadByte(); - num |= (uint)((b & 0x7F) << i); - if ((uint)b <= 127u) - { - return (int)num; - } - } - b = reader.ReadByte(); - if ((uint)b > 15u) - { - throw new FormatException(SR.Format_Bad7BitInt); - } - return (int)num | (b << 28); - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ResourceTypeCode.cs b/src/PRE_NET6_0_POLYFILLS/ResourceTypeCode.cs deleted file mode 100644 index 039edeb..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ResourceTypeCode.cs +++ /dev/null @@ -1,33 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -namespace System.Resources; - -internal enum ResourceTypeCode -{ - Null = 0, - String = 1, - Boolean = 2, - Char = 3, - Byte = 4, - SByte = 5, - Int16 = 6, - UInt16 = 7, - Int32 = 8, - UInt32 = 9, - Int64 = 10, - UInt64 = 11, - Single = 12, - Double = 13, - Decimal = 14, - DateTime = 15, - TimeSpan = 16, - LastPrimitive = 16, - ByteArray = 32, - Stream = 33, - StartOfUserTypes = 64 -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/RuntimeResourceSet.cs b/src/PRE_NET6_0_POLYFILLS/RuntimeResourceSet.cs deleted file mode 100644 index 72e86a0..0000000 --- a/src/PRE_NET6_0_POLYFILLS/RuntimeResourceSet.cs +++ /dev/null @@ -1,194 +0,0 @@ -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -#if !NET6_0_OR_GREATER -using System.Collections; - -using System.Collections.Generic; -using System.IO; -using System.Threading; - -namespace System.Resources; - -internal sealed class RuntimeResourceSet : ResourceSet, IEnumerable -{ - private Dictionary _resCache; - - private _ResourceReader _defaultReader; - - private Dictionary _caseInsensitiveTable; - - internal RuntimeResourceSet(string fileName) - : this(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { } - - internal RuntimeResourceSet(Stream stream, bool permitDeserialization = false) - : base() - { - _resCache = new Dictionary(FastResourceComparer.Default); - _defaultReader = new _ResourceReader(stream, _resCache, permitDeserialization); - } - - protected override void Dispose(bool disposing) - { - if (_defaultReader != null) - { - if (disposing) - { - _defaultReader?.Close(); - } - _defaultReader = null!; - _resCache = null!; - _caseInsensitiveTable = null!; - base.Dispose(disposing); - } - } - - public override IDictionaryEnumerator GetEnumerator() - { - return GetEnumeratorHelper(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumeratorHelper(); - } - - private IDictionaryEnumerator GetEnumeratorHelper() - { - _ResourceReader? defaultReader = _defaultReader; - if (defaultReader == null) - { - throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet); - } - return defaultReader.GetEnumerator(); - } - - public override string? GetString(string key) - { - object? @object = GetObject(key, ignoreCase: false, isString: true); - return (string?)@object; - } - - public override string? GetString(string key, bool ignoreCase) - { - object? @object = GetObject(key, ignoreCase, isString: true); - return (string?)@object; - } - - public override object? GetObject(string key) - { - return GetObject(key, ignoreCase: false, isString: false); - } - - public override object? GetObject(string key, bool ignoreCase) - { - return GetObject(key, ignoreCase, isString: false); - } - - private object? GetObject(string key, bool ignoreCase, bool isString) - { - if (key is null) - { - throw new ArgumentNullException(nameof(key)); - } - _ResourceReader? defaultReader = _defaultReader; - Dictionary resCache = _resCache!; - if (defaultReader == null || resCache == null) - { - throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet); - } - ResourceLocator value; - lock (resCache) - { - int dataPosition; - if (resCache.TryGetValue(key, out value)) - { - object? value2 = value.Value; - if (value2 != null) - { - return value2; - } - dataPosition = value.DataPosition; - return isString - ? defaultReader.LoadString(dataPosition) - : defaultReader.LoadObject(dataPosition); - } - dataPosition = defaultReader.FindPosForResource(key); - if (dataPosition >= 0) - { - object? value2 = ReadValue(defaultReader, dataPosition, isString, out value); - resCache[key] = value; - return value2; - } - } - if (!ignoreCase) - { - return null; - } - bool flag = false; - Dictionary dictionary = _caseInsensitiveTable; - if (dictionary == null) - { - dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); - flag = true; - } - lock (dictionary) - { - if (flag) - { - _ResourceReader.ResourceEnumerator enumeratorInternal = - defaultReader.GetEnumeratorInternal(); - while (enumeratorInternal.MoveNext()) - { - string key2 = (string)enumeratorInternal.Key; - ResourceLocator value3 = new ResourceLocator( - enumeratorInternal.DataPosition, - null - )!; - dictionary.Add(key2, value3); - } - _caseInsensitiveTable = dictionary; - } - if (!dictionary.TryGetValue(key, out value)) - { - return null; - } - if (value.Value != null) - { - return value.Value; - } - object? value2 = ReadValue(defaultReader, value.DataPosition, isString, out value); - if (value.Value != null) - { - dictionary[key] = value; - return value2; - } - return value2; - } - } - - private static object? ReadValue( - _ResourceReader reader, - int dataPos, - bool isString, - out ResourceLocator locator - ) - { - object? obj; - ResourceTypeCode typeCode; - if (isString) - { - obj = reader.LoadString(dataPos); - typeCode = ResourceTypeCode.String; - } - else - { - obj = reader.LoadObject(dataPos, out typeCode); - } - locator = new ResourceLocator(dataPos, ResourceLocator.CanCache(typeCode) ? obj : null); - return obj; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/SR.cs b/src/PRE_NET6_0_POLYFILLS/SR.cs deleted file mode 100644 index 884aadc..0000000 --- a/src/PRE_NET6_0_POLYFILLS/SR.cs +++ /dev/null @@ -1,2719 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -using System.Collections.Generic; -using System.IO; -// using System.Private.CoreLib; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace System; - -public static class SR -{ - private static readonly object _lock = new object(); - - private static ResourceManager s_resourceManager; - - public static ResourceManager ResourceManager => - s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR))); - - private static bool UsingResourceKeys() => true; - - public const string Acc_CreateAbstEx = "Acc_CreateAbstEx"; - - public const string Acc_CreateArgIterator = "Acc_CreateArgIterator"; - - public const string Acc_CreateGenericEx = "Acc_CreateGenericEx"; - - public const string Acc_CreateInterfaceEx = "Acc_CreateInterfaceEx"; - - public const string Acc_CreateVoid = "Acc_CreateVoid"; - - public const string Acc_NotClassInit = "Acc_NotClassInit"; - - public const string Acc_ReadOnly = "Acc_ReadOnly"; - - public const string Access_Void = "Access_Void"; - - public const string AggregateException_ctor_DefaultMessage = - "AggregateException_ctor_DefaultMessage"; - - public const string AggregateException_ctor_InnerExceptionNull = - "AggregateException_ctor_InnerExceptionNull"; - - public const string AggregateException_DeserializationFailure = - "AggregateException_DeserializationFailure"; - - public const string AggregateException_InnerException = "AggregateException_InnerException"; - - public const string AppDomain_Name = "AppDomain_Name"; - - public const string AppDomain_NoContextPolicies = "AppDomain_NoContextPolicies"; - - public const string AppDomain_Policy_PrincipalTwice = "AppDomain_Policy_PrincipalTwice"; - - public const string AmbiguousImplementationException_NullMessage = - "AmbiguousImplementationException_NullMessage"; - - public const string Arg_AccessException = "Arg_AccessException"; - - public const string Arg_AccessViolationException = "Arg_AccessViolationException"; - - public const string Arg_AmbiguousMatchException = "Arg_AmbiguousMatchException"; - - public const string Arg_ApplicationException = "Arg_ApplicationException"; - - public const string Arg_ArgumentException = "Arg_ArgumentException"; - - public const string Arg_ArgumentOutOfRangeException = "Arg_ArgumentOutOfRangeException"; - - public const string Arg_ArithmeticException = "Arg_ArithmeticException"; - - public const string Arg_ArrayLengthsDiffer = "Arg_ArrayLengthsDiffer"; - - public const string Arg_ArrayPlusOffTooSmall = "Arg_ArrayPlusOffTooSmall"; - - public const string Arg_ByteArrayTooSmallForValue = "Arg_ByteArrayTooSmallForValue"; - - public const string Arg_ArrayTypeMismatchException = "Arg_ArrayTypeMismatchException"; - - public const string Arg_ArrayZeroError = "Arg_ArrayZeroError"; - - public const string Arg_BadDecimal = "Arg_BadDecimal"; - - public const string Arg_BadImageFormatException = "Arg_BadImageFormatException"; - - public const string Arg_BadLiteralFormat = "Arg_BadLiteralFormat"; - - public const string Arg_BogusIComparer = "Arg_BogusIComparer"; - - public const string Arg_BufferTooSmall = "Arg_BufferTooSmall"; - - public const string Arg_CannotBeNaN = "Arg_CannotBeNaN"; - - public const string Arg_CannotHaveNegativeValue = "Arg_CannotHaveNegativeValue"; - - public const string Arg_CannotMixComparisonInfrastructure = - "Arg_CannotMixComparisonInfrastructure"; - - public const string Arg_CannotUnloadAppDomainException = "Arg_CannotUnloadAppDomainException"; - - public const string Arg_COMException = "Arg_COMException"; - - public const string Arg_CreatInstAccess = "Arg_CreatInstAccess"; - - public const string Arg_CryptographyException = "Arg_CryptographyException"; - - public const string Arg_CustomAttributeFormatException = "Arg_CustomAttributeFormatException"; - - public const string Arg_DataMisalignedException = "Arg_DataMisalignedException"; - - public const string Arg_DecBitCtor = "Arg_DecBitCtor"; - - public const string Arg_DirectoryNotFoundException = "Arg_DirectoryNotFoundException"; - - public const string Arg_DivideByZero = "Arg_DivideByZero"; - - public const string Arg_DlgtNullInst = "Arg_DlgtNullInst"; - - public const string Arg_DlgtTargMeth = "Arg_DlgtTargMeth"; - - public const string Arg_DlgtTypeMis = "Arg_DlgtTypeMis"; - - public const string Arg_DllNotFoundException = "Arg_DllNotFoundException"; - - public const string Arg_DuplicateWaitObjectException = "Arg_DuplicateWaitObjectException"; - - public const string Arg_EHClauseNotClause = "Arg_EHClauseNotClause"; - - public const string Arg_EHClauseNotFilter = "Arg_EHClauseNotFilter"; - - public const string Arg_EmptyArray = "Arg_EmptyArray"; - - public const string Arg_EmptySpan = "Arg_EmptySpan"; - - public const string Arg_EndOfStreamException = "Arg_EndOfStreamException"; - - public const string Arg_EntryPointNotFoundException = "Arg_EntryPointNotFoundException"; - - public const string Arg_EnumAndObjectMustBeSameType = "Arg_EnumAndObjectMustBeSameType"; - - public const string Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType = - "Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType"; - - public const string Arg_EnumIllegalVal = "Arg_EnumIllegalVal"; - - public const string Arg_EnumLitValueNotFound = "Arg_EnumLitValueNotFound"; - - public const string Arg_EnumUnderlyingTypeAndObjectMustBeSameType = - "Arg_EnumUnderlyingTypeAndObjectMustBeSameType"; - - public const string Arg_EnumValueNotFound = "Arg_EnumValueNotFound"; - - public const string Arg_ExecutionEngineException = "Arg_ExecutionEngineException"; - - public const string Arg_ExternalException = "Arg_ExternalException"; - - public const string Arg_FieldAccessException = "Arg_FieldAccessException"; - - public const string Arg_FieldDeclTarget = "Arg_FieldDeclTarget"; - - public const string Arg_FldGetArgErr = "Arg_FldGetArgErr"; - - public const string Arg_FldGetPropSet = "Arg_FldGetPropSet"; - - public const string Arg_FldSetArgErr = "Arg_FldSetArgErr"; - - public const string Arg_FldSetGet = "Arg_FldSetGet"; - - public const string Arg_FldSetInvoke = "Arg_FldSetInvoke"; - - public const string Arg_FldSetPropGet = "Arg_FldSetPropGet"; - - public const string Arg_FormatException = "Arg_FormatException"; - - public const string Arg_GenericParameter = "Arg_GenericParameter"; - - public const string Arg_GetMethNotFnd = "Arg_GetMethNotFnd"; - - public const string Arg_GuidArrayCtor = "Arg_GuidArrayCtor"; - - public const string Arg_HandleNotAsync = "Arg_HandleNotAsync"; - - public const string Arg_HandleNotSync = "Arg_HandleNotSync"; - - public const string Arg_HexBinaryStylesNotSupported = "Arg_HexBinaryStylesNotSupported"; - - public const string Arg_HTCapacityOverflow = "Arg_HTCapacityOverflow"; - - public const string Arg_IndexMustBeInt = "Arg_IndexMustBeInt"; - - public const string Arg_IndexOutOfRangeException = "Arg_IndexOutOfRangeException"; - - public const string Arg_InsufficientExecutionStackException = - "Arg_InsufficientExecutionStackException"; - - public const string Arg_InvalidBase = "Arg_InvalidBase"; - - public const string Arg_InvalidCastException = "Arg_InvalidCastException"; - - public const string Arg_InvalidComObjectException = "Arg_InvalidComObjectException"; - - public const string Arg_InvalidFilterCriteriaException = "Arg_InvalidFilterCriteriaException"; - - public const string Arg_InvalidHandle = "Arg_InvalidHandle"; - - public const string Arg_InvalidHexBinaryStyle = "Arg_InvalidHexBinaryStyle"; - - public const string Arg_InvalidNeutralResourcesLanguage_Asm_Culture = - "Arg_InvalidNeutralResourcesLanguage_Asm_Culture"; - - public const string Arg_InvalidNeutralResourcesLanguage_FallbackLoc = - "Arg_InvalidNeutralResourcesLanguage_FallbackLoc"; - - public const string Arg_InvalidSatelliteContract_Asm_Ver = - "Arg_InvalidSatelliteContract_Asm_Ver"; - - public const string Arg_InvalidOleVariantTypeException = "Arg_InvalidOleVariantTypeException"; - - public const string Arg_InvalidOperationException = "Arg_InvalidOperationException"; - - public const string Arg_InvalidTypeInRetType = "Arg_InvalidTypeInRetType"; - - public const string Arg_InvalidTypeInSignature = "Arg_InvalidTypeInSignature"; - - public const string Arg_IOException = "Arg_IOException"; - - public const string Arg_KeyNotFound = "Arg_KeyNotFound"; - - public const string Arg_KeyNotFoundWithKey = "Arg_KeyNotFoundWithKey"; - - public const string Arg_LongerThanDestArray = "Arg_LongerThanDestArray"; - - public const string Arg_LongerThanSrcArray = "Arg_LongerThanSrcArray"; - - public const string Arg_LongerThanSrcString = "Arg_LongerThanSrcString"; - - public const string Arg_LowerBoundsMustMatch = "Arg_LowerBoundsMustMatch"; - - public const string Arg_MarshalAsAnyRestriction = "Arg_MarshalAsAnyRestriction"; - - public const string Arg_MarshalDirectiveException = "Arg_MarshalDirectiveException"; - - public const string Arg_MethodAccessException = "Arg_MethodAccessException"; - - public const string Arg_MissingFieldException = "Arg_MissingFieldException"; - - public const string Arg_MissingManifestResourceException = - "Arg_MissingManifestResourceException"; - - public const string Arg_MissingMemberException = "Arg_MissingMemberException"; - - public const string Arg_MissingMethodException = "Arg_MissingMethodException"; - - public const string Arg_MulticastNotSupportedException = "Arg_MulticastNotSupportedException"; - - public const string Arg_MustBeBoolean = "Arg_MustBeBoolean"; - - public const string Arg_MustBeByte = "Arg_MustBeByte"; - - public const string Arg_MustBeChar = "Arg_MustBeChar"; - - public const string Arg_MustBeDateOnly = "Arg_MustBeDateOnly"; - - public const string Arg_MustBeTimeOnly = "Arg_MustBeTimeOnly"; - - public const string Arg_MustBeDateTime = "Arg_MustBeDateTime"; - - public const string Arg_MustBeDateTimeOffset = "Arg_MustBeDateTimeOffset"; - - public const string Arg_MustBeDecimal = "Arg_MustBeDecimal"; - - public const string Arg_MustBeDelegate = "Arg_MustBeDelegate"; - - public const string Arg_MustBeDouble = "Arg_MustBeDouble"; - - public const string Arg_MustBeEnum = "Arg_MustBeEnum"; - - public const string Arg_MustBeEnumBaseTypeOrEnum = "Arg_MustBeEnumBaseTypeOrEnum"; - - public const string Arg_MustBeGuid = "Arg_MustBeGuid"; - - public const string Arg_MustBeInt16 = "Arg_MustBeInt16"; - - public const string Arg_MustBeInt32 = "Arg_MustBeInt32"; - - public const string Arg_MustBeInt64 = "Arg_MustBeInt64"; - - public const string Arg_MustBeInt128 = "Arg_MustBeInt128"; - - public const string Arg_MustBeIntPtr = "Arg_MustBeIntPtr"; - - public const string Arg_MustBeNFloat = "Arg_MustBeNFloat"; - - public const string Arg_MustBePointer = "Arg_MustBePointer"; - - public const string Arg_MustBePrimArray = "Arg_MustBePrimArray"; - - public const string Arg_MustBeRuntimeAssembly = "Arg_MustBeRuntimeAssembly"; - - public const string Arg_MustBeSByte = "Arg_MustBeSByte"; - - public const string Arg_MustBeSingle = "Arg_MustBeSingle"; - - public const string Arg_MustBeString = "Arg_MustBeString"; - - public const string Arg_MustBeTimeSpan = "Arg_MustBeTimeSpan"; - - public const string Arg_MustBeType = "Arg_MustBeType"; - - public const string Arg_MustBeTrue = "Arg_MustBeTrue"; - - public const string Arg_MustBeUInt16 = "Arg_MustBeUInt16"; - - public const string Arg_MustBeUInt32 = "Arg_MustBeUInt32"; - - public const string Arg_MustBeUInt64 = "Arg_MustBeUInt64"; - - public const string Arg_MustBeUInt128 = "Arg_MustBeUInt128"; - - public const string Arg_MustBeUIntPtr = "Arg_MustBeUIntPtr"; - - public const string Arg_MustBeVersion = "Arg_MustBeVersion"; - - public const string Arg_MustContainEnumInfo = "Arg_MustContainEnumInfo"; - - public const string Arg_NamedParamNull = "Arg_NamedParamNull"; - - public const string Arg_NamedParamTooBig = "Arg_NamedParamTooBig"; - - public const string Arg_NDirectBadObject = "Arg_NDirectBadObject"; - - public const string Arg_Need1DArray = "Arg_Need1DArray"; - - public const string Arg_Need2DArray = "Arg_Need2DArray"; - - public const string Arg_Need3DArray = "Arg_Need3DArray"; - - public const string Arg_NeedAtLeast1Rank = "Arg_NeedAtLeast1Rank"; - - public const string Arg_NoAccessSpec = "Arg_NoAccessSpec"; - - public const string Arg_NoDefCTorWithoutTypeName = "Arg_NoDefCTorWithoutTypeName"; - - public const string Arg_NoDefCTor = "Arg_NoDefCTor"; - - public const string Arg_NonZeroLowerBound = "Arg_NonZeroLowerBound"; - - public const string Arg_NoStaticVirtual = "Arg_NoStaticVirtual"; - - public const string Arg_NotFiniteNumberException = "Arg_NotFiniteNumberException"; - - public const string Arg_NotGenericMethodDefinition = "Arg_NotGenericMethodDefinition"; - - public const string Arg_NotGenericParameter = "Arg_NotGenericParameter"; - - public const string Arg_NotGenericTypeDefinition = "Arg_NotGenericTypeDefinition"; - - public const string Arg_NotImplementedException = "Arg_NotImplementedException"; - - public const string Arg_NotSupportedException = "Arg_NotSupportedException"; - - public const string Arg_NullReferenceException = "Arg_NullReferenceException"; - - public const string Arg_ObjObjEx = "Arg_ObjObjEx"; - - public const string Arg_OleAutDateInvalid = "Arg_OleAutDateInvalid"; - - public const string Arg_OleAutDateScale = "Arg_OleAutDateScale"; - - public const string Arg_OverflowException = "Arg_OverflowException"; - - public const string Arg_ParamName_Name = "Arg_ParamName_Name"; - - public const string Arg_ParmArraySize = "Arg_ParmArraySize"; - - public const string Arg_ParmCnt = "Arg_ParmCnt"; - - public const string Arg_PathEmpty = "Arg_PathEmpty"; - - public const string Arg_PlatformNotSupported = "Arg_PlatformNotSupported"; - - public const string Arg_PropSetGet = "Arg_PropSetGet"; - - public const string Arg_PropSetInvoke = "Arg_PropSetInvoke"; - - public const string Arg_RankException = "Arg_RankException"; - - public const string Arg_RankIndices = "Arg_RankIndices"; - - public const string Arg_RankMultiDimNotSupported = "Arg_RankMultiDimNotSupported"; - - public const string Arg_RanksAndBounds = "Arg_RanksAndBounds"; - - public const string Arg_ResMgrNotResSet = "Arg_ResMgrNotResSet"; - - public const string Arg_ResourceFileUnsupportedVersion = "Arg_ResourceFileUnsupportedVersion"; - - public const string Arg_ResourceNameNotExist = "Arg_ResourceNameNotExist"; - - public const string Arg_SafeArrayRankMismatchException = "Arg_SafeArrayRankMismatchException"; - - public const string Arg_SafeArrayTypeMismatchException = "Arg_SafeArrayTypeMismatchException"; - - public const string Arg_SecurityException = "Arg_SecurityException"; - - public const string SerializationException = "SerializationException"; - - public const string Arg_SetMethNotFnd = "Arg_SetMethNotFnd"; - - public const string Arg_StackOverflowException = "Arg_StackOverflowException"; - - public const string Arg_SurrogatesNotAllowedAsSingleChar = - "Arg_SurrogatesNotAllowedAsSingleChar"; - - public const string Arg_SynchronizationLockException = "Arg_SynchronizationLockException"; - - public const string Arg_SystemException = "Arg_SystemException"; - - public const string Arg_TargetInvocationException = "Arg_TargetInvocationException"; - - public const string Arg_TargetParameterCountException = "Arg_TargetParameterCountException"; - - public const string Arg_ThreadStartException = "Arg_ThreadStartException"; - - public const string Arg_ThreadStateException = "Arg_ThreadStateException"; - - public const string Arg_TimeoutException = "Arg_TimeoutException"; - - public const string Arg_TypeAccessException = "Arg_TypeAccessException"; - - public const string Arg_TypedReference_Null = "Arg_TypedReference_Null"; - - public const string Arg_TypeLoadException = "Arg_TypeLoadException"; - - public const string Arg_TypeLoadNullStr = "Arg_TypeLoadNullStr"; - - public const string Arg_TypeRefPrimitive = "Arg_TypeRefPrimitive"; - - public const string Arg_TypeUnloadedException = "Arg_TypeUnloadedException"; - - public const string Arg_UnauthorizedAccessException = "Arg_UnauthorizedAccessException"; - - public const string Arg_UnboundGenField = "Arg_UnboundGenField"; - - public const string Arg_UnboundGenParam = "Arg_UnboundGenParam"; - - public const string Arg_UnknownTypeCode = "Arg_UnknownTypeCode"; - - public const string Arg_UnreachableException = "Arg_UnreachableException"; - - public const string Arg_VarMissNull = "Arg_VarMissNull"; - - public const string Arg_VersionString = "Arg_VersionString"; - - public const string Arg_WrongType = "Arg_WrongType"; - - public const string Argument_AbsolutePathRequired = "Argument_AbsolutePathRequired"; - - public const string Argument_AddingDuplicate = "Argument_AddingDuplicate"; - - public const string Argument_AddingDuplicate__ = "Argument_AddingDuplicate__"; - - public const string Argument_AddingDuplicateWithKey = "Argument_AddingDuplicateWithKey"; - - public const string Argument_AdjustmentRulesNoNulls = "Argument_AdjustmentRulesNoNulls"; - - public const string Argument_AdjustmentRulesOutOfOrder = "Argument_AdjustmentRulesOutOfOrder"; - - public const string Argument_AlignmentMustBePow2 = "Argument_AlignmentMustBePow2"; - - public const string Argument_ArrayGetInterfaceMap = "Argument_ArrayGetInterfaceMap"; - - public const string Argument_ArraysInvalid = "Argument_ArraysInvalid"; - - public const string Argument_AttributeNamesMustBeUnique = "Argument_AttributeNamesMustBeUnique"; - - public const string Argument_BadConstructor = "Argument_BadConstructor"; - - public const string Argument_BadConstructorCallConv = "Argument_BadConstructorCallConv"; - - public const string Argument_BadExceptionCodeGen = "Argument_BadExceptionCodeGen"; - - public const string Argument_BadFieldForConstructorBuilder = - "Argument_BadFieldForConstructorBuilder"; - - public const string Argument_BadFieldSig = "Argument_BadFieldSig"; - - public const string Argument_BadFieldType = "Argument_BadFieldType"; - - public const string Argument_BadFormatSpecifier = "Argument_BadFormatSpecifier"; - - public const string Argument_BadImageFormatExceptionResolve = - "Argument_BadImageFormatExceptionResolve"; - - public const string Argument_BadLabel = "Argument_BadLabel"; - - public const string Argument_BadLabelContent = "Argument_BadLabelContent"; - - public const string Argument_BadNestedTypeFlags = "Argument_BadNestedTypeFlags"; - - public const string Argument_BadParameterCountsForConstructor = - "Argument_BadParameterCountsForConstructor"; - - public const string Argument_BadParameterTypeForCAB = "Argument_BadParameterTypeForCAB"; - - public const string Argument_BadPropertyForConstructorBuilder = - "Argument_BadPropertyForConstructorBuilder"; - - public const string Argument_BadSigFormat = "Argument_BadSigFormat"; - - public const string Argument_BadSizeForData = "Argument_BadSizeForData"; - - public const string Argument_BadTypeAttrInvalidLayout = "Argument_BadTypeAttrInvalidLayout"; - - public const string Argument_BadTypeAttrNestedVisibilityOnNonNestedType = - "Argument_BadTypeAttrNestedVisibilityOnNonNestedType"; - - public const string Argument_BadTypeAttrNonNestedVisibilityNestedType = - "Argument_BadTypeAttrNonNestedVisibilityNestedType"; - - public const string Argument_BadTypeAttrReservedBitsSet = "Argument_BadTypeAttrReservedBitsSet"; - - public const string Argument_BadTypeInCustomAttribute = "Argument_BadTypeInCustomAttribute"; - - public const string Argument_CannotSetParentToInterface = "Argument_CannotSetParentToInterface"; - - public const string Argument_CodepageNotSupported = "Argument_CodepageNotSupported"; - - public const string Argument_CompareOptionOrdinal = "Argument_CompareOptionOrdinal"; - - public const string Argument_ConflictingDateTimeRoundtripStyles = - "Argument_ConflictingDateTimeRoundtripStyles"; - - public const string Argument_ConflictingDateTimeStyles = "Argument_ConflictingDateTimeStyles"; - - public const string Argument_ConstantDoesntMatch = "Argument_ConstantDoesntMatch"; - - public const string Argument_ConstantNotSupported = "Argument_ConstantNotSupported"; - - public const string Argument_ConstantNull = "Argument_ConstantNull"; - - public const string Argument_ConstructorNeedGenericDeclaringType = - "Argument_ConstructorNeedGenericDeclaringType"; - - public const string Argument_ConversionOverflow = "Argument_ConversionOverflow"; - - public const string Argument_ConvertMismatch = "Argument_ConvertMismatch"; - - public const string Argument_CultureIetfNotSupported = "Argument_CultureIetfNotSupported"; - - public const string Argument_CultureInvalidIdentifier = "Argument_CultureInvalidIdentifier"; - - public const string Argument_CultureIsNeutral = "Argument_CultureIsNeutral"; - - public const string Argument_CultureNotSupported = "Argument_CultureNotSupported"; - - public const string Argument_CultureNotSupportedInInvariantMode = - "Argument_CultureNotSupportedInInvariantMode"; - - public const string Argument_CustomAssemblyLoadContextRequestedNameMismatch = - "Argument_CustomAssemblyLoadContextRequestedNameMismatch"; - - public const string Argument_CustomCultureCannotBePassedByNumber = - "Argument_CustomCultureCannotBePassedByNumber"; - - public const string Argument_DateTimeBadBinaryData = "Argument_DateTimeBadBinaryData"; - - public const string Argument_DateTimeHasTicks = "Argument_DateTimeHasTicks"; - - public const string Argument_DateTimeHasTimeOfDay = "Argument_DateTimeHasTimeOfDay"; - - public const string Argument_DateTimeIsInvalid = "Argument_DateTimeIsInvalid"; - - public const string Argument_DateTimeIsNotAmbiguous = "Argument_DateTimeIsNotAmbiguous"; - - public const string Argument_DateTimeKindMustBeUnspecified = - "Argument_DateTimeKindMustBeUnspecified"; - - public const string Argument_DateTimeKindMustBeUnspecifiedOrUtc = - "Argument_DateTimeKindMustBeUnspecifiedOrUtc"; - - public const string Argument_DateTimeOffsetInvalidDateTimeStyles = - "Argument_DateTimeOffsetInvalidDateTimeStyles"; - - public const string Argument_DateTimeOffsetIsNotAmbiguous = - "Argument_DateTimeOffsetIsNotAmbiguous"; - - public const string Argument_DestinationTooShort = "Argument_DestinationTooShort"; - - public const string Argument_DuplicateTypeName = "Argument_DuplicateTypeName"; - - public const string Argument_EmitWriteLineType = "Argument_EmitWriteLineType"; - - public const string Argument_EmptyWaithandleArray = "Argument_EmptyWaithandleArray"; - - public const string Argument_EncoderFallbackNotEmpty = "Argument_EncoderFallbackNotEmpty"; - - public const string Argument_EncodingConversionOverflowBytes = - "Argument_EncodingConversionOverflowBytes"; - - public const string Argument_EncodingConversionOverflowChars = - "Argument_EncodingConversionOverflowChars"; - - public const string Argument_EncodingNotSupported = "Argument_EncodingNotSupported"; - - public const string Argument_EnumTypeDoesNotMatch = "Argument_EnumTypeDoesNotMatch"; - - public const string Argument_FallbackBufferNotEmpty = "Argument_FallbackBufferNotEmpty"; - - public const string Argument_FieldDeclaringTypeGeneric = "Argument_FieldDeclaringTypeGeneric"; - - public const string Argument_FieldNeedGenericDeclaringType = - "Argument_FieldNeedGenericDeclaringType"; - - public const string Argument_GenConstraintViolation = "Argument_GenConstraintViolation"; - - public const string Argument_GenericArgsCount = "Argument_GenericArgsCount"; - - public const string Argument_GenericsInvalid = "Argument_GenericsInvalid"; - - public const string Argument_GlobalMembersMustBeStatic = "Argument_GlobalMembersMustBeStatic"; - - public const string Argument_HasToBeArrayClass = "Argument_HasToBeArrayClass"; - - public const string Argument_IdnBadBidi = "Argument_IdnBadBidi"; - - public const string Argument_IdnBadLabelSize = "Argument_IdnBadLabelSize"; - - public const string Argument_IdnBadNameSize = "Argument_IdnBadNameSize"; - - public const string Argument_IdnBadPunycode = "Argument_IdnBadPunycode"; - - public const string Argument_IdnBadStd3 = "Argument_IdnBadStd3"; - - public const string Argument_IdnIllegalName = "Argument_IdnIllegalName"; - - public const string Argument_IllegalEnvVarName = "Argument_IllegalEnvVarName"; - - public const string Argument_IllegalName = "Argument_IllegalName"; - - public const string Argument_ImplementIComparable = "Argument_ImplementIComparable"; - - public const string Argument_InvalidAppendMode = "Argument_InvalidAppendMode"; - - public const string Argument_InvalidPreallocateAccess = "Argument_InvalidPreallocateAccess"; - - public const string Argument_InvalidPreallocateMode = "Argument_InvalidPreallocateMode"; - - public const string Argument_InvalidUnixCreateMode = "Argument_InvalidUnixCreateMode"; - - public const string Argument_InvalidArgumentForComparison = - "Argument_InvalidArgumentForComparison"; - - public const string Argument_InvalidArrayLength = "Argument_InvalidArrayLength"; - - public const string Argument_IncompatibleArrayType = "Argument_IncompatibleArrayType"; - - public const string InvalidAssemblyName = "InvalidAssemblyName"; - - public const string Argument_InvalidCalendar = "Argument_InvalidCalendar"; - - public const string Argument_InvalidCharSequence = "Argument_InvalidCharSequence"; - - public const string Argument_InvalidCharSequenceNoIndex = "Argument_InvalidCharSequenceNoIndex"; - - public const string Argument_InvalidCodePageBytesIndex = "Argument_InvalidCodePageBytesIndex"; - - public const string Argument_InvalidCodePageConversionIndex = - "Argument_InvalidCodePageConversionIndex"; - - public const string Argument_InvalidConstructorDeclaringType = - "Argument_InvalidConstructorDeclaringType"; - - public const string Argument_InvalidConstructorInfo = "Argument_InvalidConstructorInfo"; - - public const string Argument_InvalidCultureName = "Argument_InvalidCultureName"; - - public const string Argument_InvalidPredefinedCultureName = - "Argument_InvalidPredefinedCultureName"; - - public const string Argument_InvalidDateTimeKind = "Argument_InvalidDateTimeKind"; - - public const string Argument_InvalidDateTimeStyles = "Argument_InvalidDateTimeStyles"; - - public const string Argument_InvalidDateStyles = "Argument_InvalidDateStyles"; - - public const string Argument_InvalidDigitSubstitution = "Argument_InvalidDigitSubstitution"; - - public const string Argument_InvalidElementName = "Argument_InvalidElementName"; - - public const string Argument_InvalidElementTag = "Argument_InvalidElementTag"; - - public const string Argument_InvalidElementText = "Argument_InvalidElementText"; - - public const string Argument_InvalidElementValue = "Argument_InvalidElementValue"; - - public const string Argument_InvalidEnum = "Argument_InvalidEnum"; - - public const string Argument_InvalidEnumValue = "Argument_InvalidEnumValue"; - - public const string Argument_InvalidFieldDeclaringType = "Argument_InvalidFieldDeclaringType"; - - public const string Argument_InvalidFileModeAndAccessCombo = - "Argument_InvalidFileModeAndAccessCombo"; - - public const string Argument_InvalidFlag = "Argument_InvalidFlag"; - - public const string Argument_InvalidGenericInstArray = "Argument_InvalidGenericInstArray"; - - public const string Argument_InvalidGroupSize = "Argument_InvalidGroupSize"; - - public const string Argument_InvalidHandle = "Argument_InvalidHandle"; - - public const string Argument_InvalidHighSurrogate = "Argument_InvalidHighSurrogate"; - - public const string Argument_InvalidId = "Argument_InvalidId"; - - public const string Argument_InvalidKindOfTypeForCA = "Argument_InvalidKindOfTypeForCA"; - - public const string Argument_InvalidLabel = "Argument_InvalidLabel"; - - public const string Argument_InvalidLowSurrogate = "Argument_InvalidLowSurrogate"; - - public const string Argument_InvalidMemberForNamedArgument = - "Argument_InvalidMemberForNamedArgument"; - - public const string Argument_InvalidMethodDeclaringType = "Argument_InvalidMethodDeclaringType"; - - public const string Argument_InvalidName = "Argument_InvalidName"; - - public const string Argument_InvalidNativeDigitCount = "Argument_InvalidNativeDigitCount"; - - public const string Argument_InvalidNativeDigitValue = "Argument_InvalidNativeDigitValue"; - - public const string Argument_InvalidNeutralRegionName = "Argument_InvalidNeutralRegionName"; - - public const string Argument_InvalidNormalizationForm = "Argument_InvalidNormalizationForm"; - - public const string Argument_InvalidNumberStyles = "Argument_InvalidNumberStyles"; - - public const string Argument_InvalidOffLen = "Argument_InvalidOffLen"; - - public const string Argument_InvalidOpCodeOnDynamicMethod = - "Argument_InvalidOpCodeOnDynamicMethod"; - - public const string Argument_InvalidParameterInfo = "Argument_InvalidParameterInfo"; - - public const string Argument_InvalidParamInfo = "Argument_InvalidParamInfo"; - - public const string Argument_NullCharInPath = "Argument_NullCharInPath"; - - public const string Argument_InvalidResourceCultureName = "Argument_InvalidResourceCultureName"; - - public const string Argument_InvalidSafeBufferOffLen = "Argument_InvalidSafeBufferOffLen"; - - public const string Argument_InvalidSeekOrigin = "Argument_InvalidSeekOrigin"; - - public const string Argument_InvalidSerializedString = "Argument_InvalidSerializedString"; - - public const string Argument_InvalidStartupHookSignature = - "Argument_InvalidStartupHookSignature"; - - public const string Argument_InvalidTimeSpanStyles = "Argument_InvalidTimeSpanStyles"; - - public const string Argument_InvalidToken = "Argument_InvalidToken"; - - public const string Argument_InvalidTypeForCA = "Argument_InvalidTypeForCA"; - - public const string Argument_InvalidTypeForDynamicMethod = - "Argument_InvalidTypeForDynamicMethod"; - - public const string Argument_InvalidTypeName = "Argument_InvalidTypeName"; - - public const string Argument_InvalidTypeWithPointersNotSupported = - "Argument_InvalidTypeWithPointersNotSupported"; - - public const string Argument_InvalidUnity = "Argument_InvalidUnity"; - - public const string Argument_LargeInteger = "Argument_LargeInteger"; - - public const string Argument_LongEnvVarValue = "Argument_LongEnvVarValue"; - - public const string Argument_MethodDeclaringTypeGeneric = "Argument_MethodDeclaringTypeGeneric"; - - public const string Argument_MethodDeclaringTypeGenericLcg = - "Argument_MethodDeclaringTypeGenericLcg"; - - public const string Argument_MethodNeedGenericDeclaringType = - "Argument_MethodNeedGenericDeclaringType"; - - public const string Argument_MinMaxValue = "Argument_MinMaxValue"; - - public const string Argument_MismatchedArrays = "Argument_MismatchedArrays"; - - public const string Argument_MustBeFalse = "Argument_MustBeFalse"; - - public const string Argument_MustBeRuntimeAssembly = "Argument_MustBeRuntimeAssembly"; - - public const string Argument_MustBeRuntimeFieldInfo = "Argument_MustBeRuntimeFieldInfo"; - - public const string Argument_MustBeRuntimeMethodInfo = "Argument_MustBeRuntimeMethodInfo"; - - public const string Argument_MustBeRuntimeType = "Argument_MustBeRuntimeType"; - - public const string Argument_MustBeTypeBuilder = "Argument_MustBeTypeBuilder"; - - public const string Argument_MustHaveAttributeBaseClass = "Argument_MustHaveAttributeBaseClass"; - - public const string Argument_NativeOverlappedAlreadyFree = - "Argument_NativeOverlappedAlreadyFree"; - - public const string Argument_NativeOverlappedWrongBoundHandle = - "Argument_NativeOverlappedWrongBoundHandle"; - - public const string Argument_NeedGenericMethodDefinition = - "Argument_NeedGenericMethodDefinition"; - - public const string Argument_NeedNonGenericType = "Argument_NeedNonGenericType"; - - public const string Argument_NeedStructWithNoRefs = "Argument_NeedStructWithNoRefs"; - - public const string Argument_NeverValidGenericArgument = "Argument_NeverValidGenericArgument"; - - public const string Argument_NoEra = "Argument_NoEra"; - - public const string Argument_NoRegionInvariantCulture = "Argument_NoRegionInvariantCulture"; - - public const string Argument_NotAWritableProperty = "Argument_NotAWritableProperty"; - - public const string Argument_NotEnoughBytesToRead = "Argument_NotEnoughBytesToRead"; - - public const string Argument_NotEnoughBytesToWrite = "Argument_NotEnoughBytesToWrite"; - - public const string Argument_NotEnoughGenArguments = "Argument_NotEnoughGenArguments"; - - public const string Argument_NotExceptionType = "Argument_NotExceptionType"; - - public const string Argument_NotInExceptionBlock = "Argument_NotInExceptionBlock"; - - public const string Argument_NotMethodCallOpcode = "Argument_NotMethodCallOpcode"; - - public const string Argument_OffsetAndCapacityOutOfBounds = - "Argument_OffsetAndCapacityOutOfBounds"; - - public const string Argument_OffsetLocalMismatch = "Argument_OffsetLocalMismatch"; - - public const string Argument_OffsetOfFieldNotFound = "Argument_OffsetOfFieldNotFound"; - - public const string Argument_OffsetOutOfRange = "Argument_OffsetOutOfRange"; - - public const string Argument_OffsetPrecision = "Argument_OffsetPrecision"; - - public const string Argument_OffsetUtcMismatch = "Argument_OffsetUtcMismatch"; - - public const string Argument_OneOfCulturesNotSupported = "Argument_OneOfCulturesNotSupported"; - - public const string Argument_OnlyMscorlib = "Argument_OnlyMscorlib"; - - public const string Argument_OutOfOrderDateTimes = "Argument_OutOfOrderDateTimes"; - - public const string Argument_PathEmpty = "Argument_PathEmpty"; - - public const string Argument_PreAllocatedAlreadyAllocated = - "Argument_PreAllocatedAlreadyAllocated"; - - public const string Argument_RecursiveFallback = "Argument_RecursiveFallback"; - - public const string Argument_RecursiveFallbackBytes = "Argument_RecursiveFallbackBytes"; - - public const string Argument_RedefinedLabel = "Argument_RedefinedLabel"; - - public const string Argument_ResolveField = "Argument_ResolveField"; - - public const string Argument_ResolveFieldHandle = "Argument_ResolveFieldHandle"; - - public const string Argument_ResolveMember = "Argument_ResolveMember"; - - public const string Argument_ResolveMethod = "Argument_ResolveMethod"; - - public const string Argument_ResolveMethodHandle = "Argument_ResolveMethodHandle"; - - public const string Argument_ResolveModuleType = "Argument_ResolveModuleType"; - - public const string Argument_ResolveString = "Argument_ResolveString"; - - public const string Argument_ResolveType = "Argument_ResolveType"; - - public const string Argument_ResultCalendarRange = "Argument_ResultCalendarRange"; - - public const string Argument_SemaphoreInitialMaximum = "Argument_SemaphoreInitialMaximum"; - - public const string Argument_ShouldNotSpecifyExceptionType = - "Argument_ShouldNotSpecifyExceptionType"; - - public const string Argument_ShouldOnlySetVisibilityFlags = - "Argument_ShouldOnlySetVisibilityFlags"; - - public const string Argument_SigIsFinalized = "Argument_SigIsFinalized"; - - public const string Argument_StreamNotReadable = "Argument_StreamNotReadable"; - - public const string Argument_StreamNotWritable = "Argument_StreamNotWritable"; - - public const string Argument_StringFirstCharIsZero = "Argument_StringFirstCharIsZero"; - - public const string Argument_TimeSpanHasSeconds = "Argument_TimeSpanHasSeconds"; - - public const string Argument_TimeZoneInfoBadTZif = "Argument_TimeZoneInfoBadTZif"; - - public const string Argument_TimeZoneInfoInvalidTZif = "Argument_TimeZoneInfoInvalidTZif"; - - public const string Argument_ToExclusiveLessThanFromExclusive = - "Argument_ToExclusiveLessThanFromExclusive"; - - public const string Argument_TooManyFinallyClause = "Argument_TooManyFinallyClause"; - - public const string Argument_TransitionTimesAreIdentical = - "Argument_TransitionTimesAreIdentical"; - - public const string Argument_TypedReferenceInvalidField = "Argument_TypedReferenceInvalidField"; - - public const string Argument_TypeMustNotBeComImport = "Argument_TypeMustNotBeComImport"; - - public const string Argument_TypeNameTooLong = "Argument_TypeNameTooLong"; - - public const string Argument_UnclosedExceptionBlock = "Argument_UnclosedExceptionBlock"; - - public const string Argument_UnknownUnmanagedCallConv = "Argument_UnknownUnmanagedCallConv"; - - public const string Argument_UnmanagedMemAccessorWrapAround = - "Argument_UnmanagedMemAccessorWrapAround"; - - public const string Argument_UnmatchedMethodForLocal = "Argument_UnmatchedMethodForLocal"; - - public const string Argument_UnmatchingSymScope = "Argument_UnmatchingSymScope"; - - public const string Argument_UTCOutOfRange = "Argument_UTCOutOfRange"; - - public const string Argument_WaitHandleNameTooLong = "Argument_WaitHandleNameTooLong"; - - public const string ArgumentException_BadMethodImplBody = "ArgumentException_BadMethodImplBody"; - - public const string ArgumentException_BufferNotFromPool = "ArgumentException_BufferNotFromPool"; - - public const string ArgumentException_OtherNotArrayOfCorrectLength = - "ArgumentException_OtherNotArrayOfCorrectLength"; - - public const string ArgumentException_NotIsomorphic = "ArgumentException_NotIsomorphic"; - - public const string ArgumentException_TupleIncorrectType = - "ArgumentException_TupleIncorrectType"; - - public const string ArgumentException_TupleLastArgumentNotATuple = - "ArgumentException_TupleLastArgumentNotATuple"; - - public const string ArgumentException_ValueTupleIncorrectType = - "ArgumentException_ValueTupleIncorrectType"; - - public const string ArgumentException_ValueTupleLastArgumentNotAValueTuple = - "ArgumentException_ValueTupleLastArgumentNotAValueTuple"; - - public const string ArgumentNull_Array = "ArgumentNull_Array"; - - public const string ArgumentNull_ArrayElement = "ArgumentNull_ArrayElement"; - - public const string ArgumentNull_ArrayValue = "ArgumentNull_ArrayValue"; - - public const string ArgumentNull_Child = "ArgumentNull_Child"; - - public const string ArgumentNull_Generic = "ArgumentNull_Generic"; - - public const string ArgumentNull_SafeHandle = "ArgumentNull_SafeHandle"; - - public const string ArgumentNull_String = "ArgumentNull_String"; - - public const string ArgumentNull_TypedRefType = "ArgumentNull_TypedRefType"; - - public const string ArgumentOutOfRange_ActualValue = "ArgumentOutOfRange_ActualValue"; - - public const string ArgumentOutOfRange_AddValue = "ArgumentOutOfRange_AddValue"; - - public const string ArgumentOutOfRange_BadHourMinuteSecond = - "ArgumentOutOfRange_BadHourMinuteSecond"; - - public const string ArgumentOutOfRange_BadYearMonthDay = "ArgumentOutOfRange_BadYearMonthDay"; - - public const string ArgumentOutOfRange_BiggerThanCollection = - "ArgumentOutOfRange_BiggerThanCollection"; - - public const string ArgumentOutOfRange_BinaryReaderFillBuffer = - "ArgumentOutOfRange_BinaryReaderFillBuffer"; - - public const string ArgumentOutOfRange_Bounds_Lower_Upper = - "ArgumentOutOfRange_Bounds_Lower_Upper"; - - public const string ArgumentOutOfRange_CalendarRange = "ArgumentOutOfRange_CalendarRange"; - - public const string ArgumentOutOfRange_Capacity = "ArgumentOutOfRange_Capacity"; - - public const string ArgumentOutOfRange_Count = "ArgumentOutOfRange_Count"; - - public const string ArgumentOutOfRange_DateArithmetic = "ArgumentOutOfRange_DateArithmetic"; - - public const string ArgumentOutOfRange_DateTimeBadMonths = - "ArgumentOutOfRange_DateTimeBadMonths"; - - public const string ArgumentOutOfRange_DateTimeBadTicks = "ArgumentOutOfRange_DateTimeBadTicks"; - - public const string ArgumentOutOfRange_TimeOnlyBadTicks = "ArgumentOutOfRange_TimeOnlyBadTicks"; - - public const string ArgumentOutOfRange_DateTimeBadYears = "ArgumentOutOfRange_DateTimeBadYears"; - - public const string ArgumentOutOfRange_Day = "ArgumentOutOfRange_Day"; - - public const string ArgumentOutOfRange_DayOfWeek = "ArgumentOutOfRange_DayOfWeek"; - - public const string ArgumentOutOfRange_DayParam = "ArgumentOutOfRange_DayParam"; - - public const string ArgumentOutOfRange_DecimalRound = "ArgumentOutOfRange_DecimalRound"; - - public const string ArgumentOutOfRange_EndIndexStartIndex = - "ArgumentOutOfRange_EndIndexStartIndex"; - - public const string ArgumentOutOfRange_Enum = "ArgumentOutOfRange_Enum"; - - public const string ArgumentOutOfRange_Era = "ArgumentOutOfRange_Era"; - - public const string ArgumentOutOfRange_FileLengthTooBig = "ArgumentOutOfRange_FileLengthTooBig"; - - public const string ArgumentOutOfRange_FileTimeInvalid = "ArgumentOutOfRange_FileTimeInvalid"; - - public const string ArgumentOutOfRange_GetByteCountOverflow = - "ArgumentOutOfRange_GetByteCountOverflow"; - - public const string ArgumentOutOfRange_GetCharCountOverflow = - "ArgumentOutOfRange_GetCharCountOverflow"; - - public const string ArgumentOutOfRange_HashtableLoadFactor = - "ArgumentOutOfRange_HashtableLoadFactor"; - - public const string ArgumentOutOfRange_HugeArrayNotSupported = - "ArgumentOutOfRange_HugeArrayNotSupported"; - - public const string ArgumentOutOfRange_IndexMustBeLess = "ArgumentOutOfRange_IndexMustBeLess"; - - public const string ArgumentOutOfRange_IndexMustBeLessOrEqual = - "ArgumentOutOfRange_IndexMustBeLessOrEqual"; - - public const string ArgumentOutOfRange_IndexCount = "ArgumentOutOfRange_IndexCount"; - - public const string ArgumentOutOfRange_IndexCountBuffer = "ArgumentOutOfRange_IndexCountBuffer"; - - public const string ArgumentOutOfRange_IndexLength = "ArgumentOutOfRange_IndexLength"; - - public const string ArgumentOutOfRange_IndexString = "ArgumentOutOfRange_IndexString"; - - public const string ArgumentOutOfRange_InvalidEraValue = "ArgumentOutOfRange_InvalidEraValue"; - - public const string ArgumentOutOfRange_InvalidHighSurrogate = - "ArgumentOutOfRange_InvalidHighSurrogate"; - - public const string ArgumentOutOfRange_InvalidLowSurrogate = - "ArgumentOutOfRange_InvalidLowSurrogate"; - - public const string ArgumentOutOfRange_InvalidUTF32 = "ArgumentOutOfRange_InvalidUTF32"; - - public const string ArgumentOutOfRange_LengthGreaterThanCapacity = - "ArgumentOutOfRange_LengthGreaterThanCapacity"; - - public const string ArgumentOutOfRange_LessEqualToIntegerMaxVal = - "ArgumentOutOfRange_LessEqualToIntegerMaxVal"; - - public const string ArgumentOutOfRange_ListInsert = "ArgumentOutOfRange_ListInsert"; - - public const string ArgumentOutOfRange_Month = "ArgumentOutOfRange_Month"; - - public const string ArgumentOutOfRange_DayNumber = "ArgumentOutOfRange_DayNumber"; - - public const string ArgumentOutOfRange_MonthParam = "ArgumentOutOfRange_MonthParam"; - - public const string ArgumentOutOfRange_MustBeNonNegNum = "ArgumentOutOfRange_MustBeNonNegNum"; - - public const string ArgumentOutOfRange_MustBePositive = "ArgumentOutOfRange_MustBePositive"; - - public const string ArgumentOutOfRange_NeedNonNegNum = "ArgumentOutOfRange_NeedNonNegNum"; - - public const string ArgumentOutOfRange_NeedNonNegOrNegative1 = - "ArgumentOutOfRange_NeedNonNegOrNegative1"; - - public const string ArgumentOutOfRange_NeedValidId = "ArgumentOutOfRange_NeedValidId"; - - public const string ArgumentOutOfRange_OffsetLength = "ArgumentOutOfRange_OffsetLength"; - - public const string ArgumentOutOfRange_OffsetOut = "ArgumentOutOfRange_OffsetOut"; - - public const string ArgumentOutOfRange_ParamSequence = "ArgumentOutOfRange_ParamSequence"; - - public const string ArgumentOutOfRange_PartialWCHAR = "ArgumentOutOfRange_PartialWCHAR"; - - public const string ArgumentOutOfRange_PositionLessThanCapacityRequired = - "ArgumentOutOfRange_PositionLessThanCapacityRequired"; - - public const string ArgumentOutOfRange_Range = "ArgumentOutOfRange_Range"; - - public const string ArgumentOutOfRange_RoundingDigits = "ArgumentOutOfRange_RoundingDigits"; - - public const string ArgumentOutOfRange_RoundingDigits_MathF = - "ArgumentOutOfRange_RoundingDigits_MathF"; - - public const string ArgumentOutOfRange_SmallCapacity = "ArgumentOutOfRange_SmallCapacity"; - - public const string ArgumentOutOfRange_StartIndex = "ArgumentOutOfRange_StartIndex"; - - public const string ArgumentOutOfRange_StartIndexLargerThanLength = - "ArgumentOutOfRange_StartIndexLargerThanLength"; - - public const string ArgumentOutOfRange_StreamLength = "ArgumentOutOfRange_StreamLength"; - - public const string ArgumentOutOfRange_UIntPtrMax = "ArgumentOutOfRange_UIntPtrMax"; - - public const string ArgumentOutOfRange_UnmanagedMemStreamLength = - "ArgumentOutOfRange_UnmanagedMemStreamLength"; - - public const string ArgumentOutOfRange_UnmanagedMemStreamWrapAround = - "ArgumentOutOfRange_UnmanagedMemStreamWrapAround"; - - public const string ArgumentOutOfRange_UtcOffset = "ArgumentOutOfRange_UtcOffset"; - - public const string ArgumentOutOfRange_UtcOffsetAndDaylightDelta = - "ArgumentOutOfRange_UtcOffsetAndDaylightDelta"; - - public const string ArgumentOutOfRange_Week = "ArgumentOutOfRange_Week"; - - public const string ArgumentOutOfRange_Year = "ArgumentOutOfRange_Year"; - - public const string ArgumentOutOfRange_Generic_MustBeNonZero = - "ArgumentOutOfRange_Generic_MustBeNonZero"; - - public const string ArgumentOutOfRange_Generic_MustBeNonNegative = - "ArgumentOutOfRange_Generic_MustBeNonNegative"; - - public const string ArgumentOutOfRange_Generic_MustBeNonNegativeNonZero = - "ArgumentOutOfRange_Generic_MustBeNonNegativeNonZero"; - - public const string ArgumentOutOfRange_Generic_MustBeLessOrEqual = - "ArgumentOutOfRange_Generic_MustBeLessOrEqual"; - - public const string ArgumentOutOfRange_Generic_MustBeLess = - "ArgumentOutOfRange_Generic_MustBeLess"; - - public const string ArgumentOutOfRange_Generic_MustBeGreaterOrEqual = - "ArgumentOutOfRange_Generic_MustBeGreaterOrEqual"; - - public const string ArgumentOutOfRange_Generic_MustBeGreater = - "ArgumentOutOfRange_Generic_MustBeGreater"; - - public const string ArgumentOutOfRange_Generic_MustBeEqual = - "ArgumentOutOfRange_Generic_MustBeEqual"; - - public const string ArgumentOutOfRange_Generic_MustBeNotEqual = - "ArgumentOutOfRange_Generic_MustBeNotEqual"; - - public const string Arithmetic_NaN = "Arithmetic_NaN"; - - public const string ArrayTypeMismatch_ConstrainedCopy = "ArrayTypeMismatch_ConstrainedCopy"; - - public const string AssemblyLoadContext_Unload_CannotUnloadIfNotCollectible = - "AssemblyLoadContext_Unload_CannotUnloadIfNotCollectible"; - - public const string AssemblyLoadContext_Verify_NotUnloading = - "AssemblyLoadContext_Verify_NotUnloading"; - - public const string AssertionFailed = "AssertionFailed"; - - public const string AssertionFailed_Cnd = "AssertionFailed_Cnd"; - - public const string AssumptionFailed = "AssumptionFailed"; - - public const string AssumptionFailed_Cnd = "AssumptionFailed_Cnd"; - - public const string AsyncMethodBuilder_InstanceNotInitialized = - "AsyncMethodBuilder_InstanceNotInitialized"; - - public const string BadImageFormat_BadILFormat = "BadImageFormat_BadILFormat"; - - public const string BadImageFormat_InvalidType = "BadImageFormat_InvalidType"; - - public const string BadImageFormat_NegativeStringLength = "BadImageFormat_NegativeStringLength"; - - public const string BadImageFormat_ParameterSignatureMismatch = - "BadImageFormat_ParameterSignatureMismatch"; - - public const string BadImageFormat_ResType_SerBlobMismatch = - "BadImageFormat_ResType_SerBlobMismatch"; - - public const string BadImageFormat_ResourceDataLengthInvalid = - "BadImageFormat_ResourceDataLengthInvalid"; - - public const string BadImageFormat_ResourceNameCorrupted = - "BadImageFormat_ResourceNameCorrupted"; - - public const string BadImageFormat_ResourceNameCorrupted_NameIndex = - "BadImageFormat_ResourceNameCorrupted_NameIndex"; - - public const string BadImageFormat_ResourcesDataInvalidOffset = - "BadImageFormat_ResourcesDataInvalidOffset"; - - public const string BadImageFormat_ResourcesHeaderCorrupted = - "BadImageFormat_ResourcesHeaderCorrupted"; - - public const string BadImageFormat_ResourcesIndexTooLong = - "BadImageFormat_ResourcesIndexTooLong"; - - public const string BadImageFormat_ResourcesNameInvalidOffset = - "BadImageFormat_ResourcesNameInvalidOffset"; - - public const string BadImageFormat_ResourcesNameTooLong = "BadImageFormat_ResourcesNameTooLong"; - - public const string BadImageFormat_TypeMismatch = "BadImageFormat_TypeMismatch"; - - public const string CancellationToken_CreateLinkedToken_TokensIsEmpty = - "CancellationToken_CreateLinkedToken_TokensIsEmpty"; - - public const string CancellationTokenSource_Disposed = "CancellationTokenSource_Disposed"; - - public const string ConcurrentCollection_SyncRoot_NotSupported = - "ConcurrentCollection_SyncRoot_NotSupported"; - - public const string EventSource_AbstractMustNotDeclareEventMethods = - "EventSource_AbstractMustNotDeclareEventMethods"; - - public const string EventSource_AbstractMustNotDeclareKTOC = - "EventSource_AbstractMustNotDeclareKTOC"; - - public const string EventSource_AddScalarOutOfRange = "EventSource_AddScalarOutOfRange"; - - public const string EventSource_BadHexDigit = "EventSource_BadHexDigit"; - - public const string EventSource_ChannelTypeDoesNotMatchEventChannelValue = - "EventSource_ChannelTypeDoesNotMatchEventChannelValue"; - - public const string EventSource_DataDescriptorsOutOfRange = - "EventSource_DataDescriptorsOutOfRange"; - - public const string EventSource_DuplicateStringKey = "EventSource_DuplicateStringKey"; - - public const string EventSource_EnumKindMismatch = "EventSource_EnumKindMismatch"; - - public const string EventSource_EvenHexDigits = "EventSource_EvenHexDigits"; - - public const string EventSource_EventChannelOutOfRange = "EventSource_EventChannelOutOfRange"; - - public const string EventSource_EventIdReused = "EventSource_EventIdReused"; - - public const string EventSource_EventMustHaveTaskIfNonDefaultOpcode = - "EventSource_EventMustHaveTaskIfNonDefaultOpcode"; - - public const string EventSource_EventMustNotBeExplicitImplementation = - "EventSource_EventMustNotBeExplicitImplementation"; - - public const string EventSource_EventNameReused = "EventSource_EventNameReused"; - - public const string EventSource_EventParametersMismatch = "EventSource_EventParametersMismatch"; - - public const string EventSource_EventSourceGuidInUse = "EventSource_EventSourceGuidInUse"; - - public const string EventSource_EventTooBig = "EventSource_EventTooBig"; - - public const string EventSource_EventWithAdminChannelMustHaveMessage = - "EventSource_EventWithAdminChannelMustHaveMessage"; - - public const string EventSource_IllegalKeywordsValue = "EventSource_IllegalKeywordsValue"; - - public const string EventSource_IllegalOpcodeValue = "EventSource_IllegalOpcodeValue"; - - public const string EventSource_IllegalTaskValue = "EventSource_IllegalTaskValue"; - - public const string EventSource_IllegalValue = "EventSource_IllegalValue"; - - public const string EventSource_IncorrentlyAuthoredTypeInfo = - "EventSource_IncorrentlyAuthoredTypeInfo"; - - public const string EventSource_InvalidCommand = "EventSource_InvalidCommand"; - - public const string EventSource_InvalidEventFormat = "EventSource_InvalidEventFormat"; - - public const string EventSource_KeywordCollision = "EventSource_KeywordCollision"; - - public const string EventSource_KeywordNeedPowerOfTwo = "EventSource_KeywordNeedPowerOfTwo"; - - public const string EventSource_ListenerCreatedInsideCallback = - "EventSource_ListenerCreatedInsideCallback"; - - public const string EventSource_ListenerNotFound = "EventSource_ListenerNotFound"; - - public const string EventSource_ListenerWriteFailure = "EventSource_ListenerWriteFailure"; - - public const string EventSource_MaxChannelExceeded = "EventSource_MaxChannelExceeded"; - - public const string EventSource_MismatchIdToWriteEvent = "EventSource_MismatchIdToWriteEvent"; - - public const string EventSource_NeedGuid = "EventSource_NeedGuid"; - - public const string EventSource_NeedName = "EventSource_NeedName"; - - public const string EventSource_NeedPositiveId = "EventSource_NeedPositiveId"; - - public const string EventSource_NoFreeBuffers = "EventSource_NoFreeBuffers"; - - public const string EventSource_NonCompliantTypeError = "EventSource_NonCompliantTypeError"; - - public const string EventSource_NoRelatedActivityId = "EventSource_NoRelatedActivityId"; - - public const string EventSource_NotSupportedArrayOfBinary = - "EventSource_NotSupportedArrayOfBinary"; - - public const string EventSource_NotSupportedArrayOfNil = "EventSource_NotSupportedArrayOfNil"; - - public const string EventSource_NotSupportedArrayOfNullTerminatedString = - "EventSource_NotSupportedArrayOfNullTerminatedString"; - - public const string EventSource_NotSupportedNestedArraysEnums = - "EventSource_NotSupportedNestedArraysEnums"; - - public const string EventSource_NullInput = "EventSource_NullInput"; - - public const string EventSource_OpcodeCollision = "EventSource_OpcodeCollision"; - - public const string EventSource_PinArrayOutOfRange = "EventSource_PinArrayOutOfRange"; - - public const string EventSource_RecursiveTypeDefinition = "EventSource_RecursiveTypeDefinition"; - - public const string EventSource_StopsFollowStarts = "EventSource_StopsFollowStarts"; - - public const string EventSource_TaskCollision = "EventSource_TaskCollision"; - - public const string EventSource_TaskOpcodePairReused = "EventSource_TaskOpcodePairReused"; - - public const string EventSource_TooManyArgs = "EventSource_TooManyArgs"; - - public const string EventSource_TooManyFields = "EventSource_TooManyFields"; - - public const string EventSource_ToString = "EventSource_ToString"; - - public const string EventSource_TraitEven = "EventSource_TraitEven"; - - public const string EventSource_TypeMustBeSealedOrAbstract = - "EventSource_TypeMustBeSealedOrAbstract"; - - public const string EventSource_TypeMustDeriveFromEventSource = - "EventSource_TypeMustDeriveFromEventSource"; - - public const string EventSource_UndefinedChannel = "EventSource_UndefinedChannel"; - - public const string EventSource_UndefinedKeyword = "EventSource_UndefinedKeyword"; - - public const string EventSource_UndefinedOpcode = "EventSource_UndefinedOpcode"; - - public const string EventSource_UnknownEtwTrait = "EventSource_UnknownEtwTrait"; - - public const string EventSource_UnsupportedEventTypeInManifest = - "EventSource_UnsupportedEventTypeInManifest"; - - public const string EventSource_UnsupportedMessageProperty = - "EventSource_UnsupportedMessageProperty"; - - public const string EventSource_VarArgsParameterMismatch = - "EventSource_VarArgsParameterMismatch"; - - public const string Exception_EndOfInnerExceptionStack = "Exception_EndOfInnerExceptionStack"; - - public const string Exception_EndStackTraceFromPreviousThrow = - "Exception_EndStackTraceFromPreviousThrow"; - - public const string Exception_WasThrown = "Exception_WasThrown"; - - public const string ExecutionContext_ExceptionInAsyncLocalNotification = - "ExecutionContext_ExceptionInAsyncLocalNotification"; - - public const string FileNotFound_ResolveAssembly = "FileNotFound_ResolveAssembly"; - - public const string FileNotFound_LoadFile = "FileNotFound_LoadFile"; - - public const string Format_AttributeUsage = "Format_AttributeUsage"; - - public const string Format_Bad7BitInt = "Format_Bad7BitInt"; - - public const string Format_BadBase64Char = "Format_BadBase64Char"; - - public const string Format_BadBoolean = "Format_BadBoolean"; - - public const string Format_BadDatePattern = "Format_BadDatePattern"; - - public const string Format_BadDateTime = "Format_BadDateTime"; - - public const string Format_BadDateOnly = "Format_BadDateOnly"; - - public const string Format_BadTimeOnly = "Format_BadTimeOnly"; - - public const string Format_DateTimeOnlyContainsNoneDateParts = - "Format_DateTimeOnlyContainsNoneDateParts"; - - public const string Format_BadDateTimeCalendar = "Format_BadDateTimeCalendar"; - - public const string Format_BadDayOfWeek = "Format_BadDayOfWeek"; - - public const string Format_BadFormatSpecifier = "Format_BadFormatSpecifier"; - - public const string Format_NoFormatSpecifier = "Format_NoFormatSpecifier"; - - public const string Format_BadHexChar = "Format_BadHexChar"; - - public const string Format_BadHexLength = "Format_BadHexLength"; - - public const string Format_BadQuote = "Format_BadQuote"; - - public const string Format_BadTimeSpan = "Format_BadTimeSpan"; - - public const string Format_DateOutOfRange = "Format_DateOutOfRange"; - - public const string Format_EmptyInputString = "Format_EmptyInputString"; - - public const string Format_ExtraJunkAtEnd = "Format_ExtraJunkAtEnd"; - - public const string Format_GuidBrace = "Format_GuidBrace"; - - public const string Format_GuidBraceAfterLastNumber = "Format_GuidBraceAfterLastNumber"; - - public const string Format_GuidComma = "Format_GuidComma"; - - public const string Format_GuidDashes = "Format_GuidDashes"; - - public const string Format_GuidEndBrace = "Format_GuidEndBrace"; - - public const string Format_GuidHexPrefix = "Format_GuidHexPrefix"; - - public const string Format_GuidInvalidChar = "Format_GuidInvalidChar"; - - public const string Format_GuidInvLen = "Format_GuidInvLen"; - - public const string Format_GuidUnrecognized = "Format_GuidUnrecognized"; - - public const string Format_IndexOutOfRange = "Format_IndexOutOfRange"; - - public const string Format_InvalidEnumFormatSpecification = - "Format_InvalidEnumFormatSpecification"; - - public const string Format_InvalidGuidFormatSpecification = - "Format_InvalidGuidFormatSpecification"; - - public const string Format_InvalidString = "Format_InvalidString"; - - public const string Format_InvalidStringWithValue = "Format_InvalidStringWithValue"; - - public const string Format_InvalidStringWithOffsetAndReason = - "Format_InvalidStringWithOffsetAndReason"; - - public const string Format_UnexpectedClosingBrace = "Format_UnexpectedClosingBrace"; - - public const string Format_UnclosedFormatItem = "Format_UnclosedFormatItem"; - - public const string Format_ExpectedAsciiDigit = "Format_ExpectedAsciiDigit"; - - public const string Format_MissingIncompleteDate = "Format_MissingIncompleteDate"; - - public const string Format_NeedSingleChar = "Format_NeedSingleChar"; - - public const string Format_NoParsibleDigits = "Format_NoParsibleDigits"; - - public const string Format_OffsetOutOfRange = "Format_OffsetOutOfRange"; - - public const string Format_RepeatDateTimePattern = "Format_RepeatDateTimePattern"; - - public const string Format_StringZeroLength = "Format_StringZeroLength"; - - public const string Format_UnknownDateTimeWord = "Format_UnknownDateTimeWord"; - - public const string Format_UTCOutOfRange = "Format_UTCOutOfRange"; - - public const string Globalization_cp_1200 = "Globalization_cp_1200"; - - public const string Globalization_cp_12000 = "Globalization_cp_12000"; - - public const string Globalization_cp_12001 = "Globalization_cp_12001"; - - public const string Globalization_cp_1201 = "Globalization_cp_1201"; - - public const string Globalization_cp_20127 = "Globalization_cp_20127"; - - public const string Globalization_cp_28591 = "Globalization_cp_28591"; - - public const string Globalization_cp_65000 = "Globalization_cp_65000"; - - public const string Globalization_cp_65001 = "Globalization_cp_65001"; - - public const string IndexOutOfRange_ArrayRankIndex = "IndexOutOfRange_ArrayRankIndex"; - - public const string IndexOutOfRange_UMSPosition = "IndexOutOfRange_UMSPosition"; - - public const string InsufficientMemory_MemFailPoint = "InsufficientMemory_MemFailPoint"; - - public const string InsufficientMemory_MemFailPoint_TooBig = - "InsufficientMemory_MemFailPoint_TooBig"; - - public const string InsufficientMemory_MemFailPoint_VAFrag = - "InsufficientMemory_MemFailPoint_VAFrag"; - - public const string Interop_Marshal_Unmappable_Char = "Interop_Marshal_Unmappable_Char"; - - public const string Interop_Marshal_SafeHandle_InvalidOperation = - "Interop_Marshal_SafeHandle_InvalidOperation"; - - public const string Interop_Marshal_CannotCreateSafeHandleField = - "Interop_Marshal_CannotCreateSafeHandleField"; - - public const string Interop_Marshal_CannotCreateCriticalHandleField = - "Interop_Marshal_CannotCreateCriticalHandleField"; - - public const string InvalidCast_CannotCastNullToValueType = - "InvalidCast_CannotCastNullToValueType"; - - public const string InvalidCast_DBNull = "InvalidCast_DBNull"; - - public const string InvalidCast_Empty = "InvalidCast_Empty"; - - public const string InvalidCast_FromDBNull = "InvalidCast_FromDBNull"; - - public const string InvalidCast_FromTo = "InvalidCast_FromTo"; - - public const string InvalidCast_IConvertible = "InvalidCast_IConvertible"; - - public const string InvalidOperation_AsyncFlowCtrlCtxMismatch = - "InvalidOperation_AsyncFlowCtrlCtxMismatch"; - - public const string InvalidOperation_AsyncIOInProgress = "InvalidOperation_AsyncIOInProgress"; - - public const string InvalidOperation_BadEmptyMethodBody = "InvalidOperation_BadEmptyMethodBody"; - - public const string InvalidOperation_BadILGeneratorUsage = - "InvalidOperation_BadILGeneratorUsage"; - - public const string InvalidOperation_BadInstructionOrIndexOutOfBound = - "InvalidOperation_BadInstructionOrIndexOutOfBound"; - - public const string InvalidOperation_BadInterfaceNotAbstract = - "InvalidOperation_BadInterfaceNotAbstract"; - - public const string InvalidOperation_BadMethodBody = "InvalidOperation_BadMethodBody"; - - public const string InvalidOperation_BadTypeAttributesNotAbstract = - "InvalidOperation_BadTypeAttributesNotAbstract"; - - public const string InvalidOperation_CalledTwice = "InvalidOperation_CalledTwice"; - - public const string InvalidOperation_CannotImportGlobalFromDifferentModule = - "InvalidOperation_CannotImportGlobalFromDifferentModule"; - - public const string InvalidOperation_CannotRegisterSecondResolver = - "InvalidOperation_CannotRegisterSecondResolver"; - - public const string InvalidOperation_CannotRestoreUnsuppressedFlow = - "InvalidOperation_CannotRestoreUnsuppressedFlow"; - - public const string InvalidOperation_CannotUseAFCOtherThread = - "InvalidOperation_CannotUseAFCOtherThread"; - - public const string InvalidOperation_CollectionCorrupted = - "InvalidOperation_CollectionCorrupted"; - - public const string InvalidOperation_ConcurrentOperationsNotSupported = - "InvalidOperation_ConcurrentOperationsNotSupported"; - - public const string InvalidOperation_ConstructorNotAllowedOnInterface = - "InvalidOperation_ConstructorNotAllowedOnInterface"; - - public const string InvalidOperation_DateTimeParsing = "InvalidOperation_DateTimeParsing"; - - public const string InvalidOperation_DefaultConstructorILGen = - "InvalidOperation_DefaultConstructorILGen"; - - public const string InvalidOperation_EnumEnded = "InvalidOperation_EnumEnded"; - - public const string InvalidOperation_EnumFailedVersion = "InvalidOperation_EnumFailedVersion"; - - public const string InvalidOperation_EnumNotStarted = "InvalidOperation_EnumNotStarted"; - - public const string InvalidOperation_EnumOpCantHappen = "InvalidOperation_EnumOpCantHappen"; - - public const string InvalidOperation_EventInfoNotAvailable = - "InvalidOperation_EventInfoNotAvailable"; - - public const string InvalidOperation_GenericParametersAlreadySet = - "InvalidOperation_GenericParametersAlreadySet"; - - public const string InvalidOperation_GlobalsHaveBeenCreated = - "InvalidOperation_GlobalsHaveBeenCreated"; - - public const string InvalidOperation_HandleIsNotInitialized = - "InvalidOperation_HandleIsNotInitialized"; - - public const string InvalidOperation_HandleIsNotPinned = "InvalidOperation_HandleIsNotPinned"; - - public const string InvalidOperation_HashInsertFailed = "InvalidOperation_HashInsertFailed"; - - public const string InvalidOperation_IComparerFailed = "InvalidOperation_IComparerFailed"; - - public const string InvalidOperation_MethodBaked = "InvalidOperation_MethodBaked"; - - public const string InvalidOperation_MethodBuilderBaked = "InvalidOperation_MethodBuilderBaked"; - - public const string InvalidOperation_MethodHasBody = "InvalidOperation_MethodHasBody"; - - public const string InvalidOperation_MustCallInitialize = "InvalidOperation_MustCallInitialize"; - - public const string InvalidOperation_NativeOverlappedReused = - "InvalidOperation_NativeOverlappedReused"; - - public const string InvalidOperation_NestedControlledExecutionRun = - "InvalidOperation_NestedControlledExecutionRun"; - - public const string InvalidOperation_NoMultiModuleAssembly = - "InvalidOperation_NoMultiModuleAssembly"; - - public const string InvalidOperation_NoPublicAddMethod = "InvalidOperation_NoPublicAddMethod"; - - public const string InvalidOperation_NoPublicRemoveMethod = - "InvalidOperation_NoPublicRemoveMethod"; - - public const string InvalidOperation_NotADebugModule = "InvalidOperation_NotADebugModule"; - - public const string InvalidOperation_NotAllowedInDynamicMethod = - "InvalidOperation_NotAllowedInDynamicMethod"; - - public const string InvalidOperation_NotAVarArgCallingConvention = - "InvalidOperation_NotAVarArgCallingConvention"; - - public const string InvalidOperation_NotGenericType = "InvalidOperation_NotGenericType"; - - public const string InvalidOperation_NotWithConcurrentGC = - "InvalidOperation_NotWithConcurrentGC"; - - public const string InvalidOperation_NoUnderlyingTypeOnEnum = - "InvalidOperation_NoUnderlyingTypeOnEnum"; - - public const string InvalidOperation_NoValue = "InvalidOperation_NoValue"; - - public const string InvalidOperation_NullArray = "InvalidOperation_NullArray"; - - public const string InvalidOperation_NullContext = "InvalidOperation_NullContext"; - - public const string InvalidOperation_NullModuleHandle = "InvalidOperation_NullModuleHandle"; - - public const string InvalidOperation_OpenLocalVariableScope = - "InvalidOperation_OpenLocalVariableScope"; - - public const string InvalidOperation_Overlapped_Pack = "InvalidOperation_Overlapped_Pack"; - - public const string InvalidOperation_PropertyInfoNotAvailable = - "InvalidOperation_PropertyInfoNotAvailable"; - - public const string InvalidOperation_ReadOnly = "InvalidOperation_ReadOnly"; - - public const string InvalidOperation_ResMgrBadResSet_Type = - "InvalidOperation_ResMgrBadResSet_Type"; - - public const string InvalidOperation_ResourceNotStream_Name = - "InvalidOperation_ResourceNotStream_Name"; - - public const string InvalidOperation_ResourceNotString_Name = - "InvalidOperation_ResourceNotString_Name"; - - public const string InvalidOperation_ResourceNotString_Type = - "InvalidOperation_ResourceNotString_Type"; - - public const string InvalidOperation_SetLatencyModeNoGC = "InvalidOperation_SetLatencyModeNoGC"; - - public const string InvalidOperation_ShouldNotHaveMethodBody = - "InvalidOperation_ShouldNotHaveMethodBody"; - - public const string InvalidOperation_ThreadWrongThreadStart = - "InvalidOperation_ThreadWrongThreadStart"; - - public const string InvalidOperation_TimeoutsNotSupported = - "InvalidOperation_TimeoutsNotSupported"; - - public const string InvalidOperation_TimerAlreadyClosed = "InvalidOperation_TimerAlreadyClosed"; - - public const string InvalidOperation_TypeHasBeenCreated = "InvalidOperation_TypeHasBeenCreated"; - - public const string InvalidOperation_TypeNotCreated = "InvalidOperation_TypeNotCreated"; - - public const string InvalidOperation_UnderlyingArrayListChanged = - "InvalidOperation_UnderlyingArrayListChanged"; - - public const string InvalidOperation_UnknownEnumType = "InvalidOperation_UnknownEnumType"; - - public const string InvalidOperation_WrongAsyncResultOrEndCalledMultiple = - "InvalidOperation_WrongAsyncResultOrEndCalledMultiple"; - - public const string InvalidProgram_Default = "InvalidProgram_Default"; - - public const string InvalidTimeZone_InvalidId = "InvalidTimeZone_InvalidId"; - - public const string InvalidTimeZone_InvalidFileData = "InvalidTimeZone_InvalidFileData"; - - public const string InvalidTimeZone_InvalidJulianDay = "InvalidTimeZone_InvalidJulianDay"; - - public const string InvalidTimeZone_NoTTInfoStructures = "InvalidTimeZone_NoTTInfoStructures"; - - public const string InvalidTimeZone_UnparsablePosixMDateString = - "InvalidTimeZone_UnparsablePosixMDateString"; - - public const string InvariantFailed = "InvariantFailed"; - - public const string InvariantFailed_Cnd = "InvariantFailed_Cnd"; - - public const string IO_NoFileTableInInMemoryAssemblies = "IO_NoFileTableInInMemoryAssemblies"; - - public const string IO_UnseekableFile = "IO_UnseekableFile"; - - public const string IO_EOF_ReadBeyondEOF = "IO_EOF_ReadBeyondEOF"; - - public const string IO_FileLoad = "IO_FileLoad"; - - public const string IO_FileName_Name = "IO_FileName_Name"; - - public const string IO_FileNotFound = "IO_FileNotFound"; - - public const string IO_FileNotFound_FileName = "IO_FileNotFound_FileName"; - - public const string IO_AlreadyExists_Name = "IO_AlreadyExists_Name"; - - public const string IO_DiskFull_Path_AllocationSize = "IO_DiskFull_Path_AllocationSize"; - - public const string IO_FileTooLarge_Path_AllocationSize = "IO_FileTooLarge_Path_AllocationSize"; - - public const string IO_FileExists_Name = "IO_FileExists_Name"; - - public const string IO_FileTooLong2GB = "IO_FileTooLong2GB"; - - public const string IO_FileTooLong = "IO_FileTooLong"; - - public const string IO_FixedCapacity = "IO_FixedCapacity"; - - public const string IO_InvalidStringLen_Len = "IO_InvalidStringLen_Len"; - - public const string IO_SeekAppendOverwrite = "IO_SeekAppendOverwrite"; - - public const string IO_SeekBeforeBegin = "IO_SeekBeforeBegin"; - - public const string IO_SetLengthAppendTruncate = "IO_SetLengthAppendTruncate"; - - public const string IO_SharingViolation_File = "IO_SharingViolation_File"; - - public const string IO_SharingViolation_NoFileName = "IO_SharingViolation_NoFileName"; - - public const string IO_StreamTooLong = "IO_StreamTooLong"; - - public const string IO_PathNotFound_NoPathName = "IO_PathNotFound_NoPathName"; - - public const string IO_PathNotFound_Path = "IO_PathNotFound_Path"; - - public const string IO_PathTooLong = "IO_PathTooLong"; - - public const string IO_PathTooLong_Path = "IO_PathTooLong_Path"; - - public const string IO_TooManySymbolicLinkLevels = "IO_TooManySymbolicLinkLevels"; - - public const string IO_UnknownFileName = "IO_UnknownFileName"; - - public const string Lazy_CreateValue_NoParameterlessCtorForT = - "Lazy_CreateValue_NoParameterlessCtorForT"; - - public const string Lazy_ctor_ModeInvalid = "Lazy_ctor_ModeInvalid"; - - public const string Lazy_StaticInit_InvalidOperation = "Lazy_StaticInit_InvalidOperation"; - - public const string Lazy_ToString_ValueNotCreated = "Lazy_ToString_ValueNotCreated"; - - public const string Lazy_Value_RecursiveCallsToValue = "Lazy_Value_RecursiveCallsToValue"; - - public const string ManualResetEventSlim_ctor_TooManyWaiters = - "ManualResetEventSlim_ctor_TooManyWaiters"; - - public const string Marshaler_StringTooLong = "Marshaler_StringTooLong"; - - public const string MissingConstructor_Name = "MissingConstructor_Name"; - - public const string MissingField = "MissingField"; - - public const string MissingField_Name = "MissingField_Name"; - - public const string MissingManifestResource_MultipleBlobs = - "MissingManifestResource_MultipleBlobs"; - - public const string MissingManifestResource_NoNeutralAsm = - "MissingManifestResource_NoNeutralAsm"; - - public const string MissingManifestResource_NoNeutralDisk = - "MissingManifestResource_NoNeutralDisk"; - - public const string MissingMember = "MissingMember"; - - public const string MissingMember_Name = "MissingMember_Name"; - - public const string MissingMemberNestErr = "MissingMemberNestErr"; - - public const string MissingMemberTypeRef = "MissingMemberTypeRef"; - - public const string MissingMethod_Name = "MissingMethod_Name"; - - public const string MissingSatelliteAssembly_Culture_Name = - "MissingSatelliteAssembly_Culture_Name"; - - public const string MissingSatelliteAssembly_Default = "MissingSatelliteAssembly_Default"; - - public const string Multicast_Combine = "Multicast_Combine"; - - public const string MustUseCCRewrite = "MustUseCCRewrite"; - - public const string NotSupported_AbstractNonCLS = "NotSupported_AbstractNonCLS"; - - public const string NotSupported_ActivAttr = "NotSupported_ActivAttr"; - - public const string NotSupported_AssemblyLoadFromHash = "NotSupported_AssemblyLoadFromHash"; - - public const string NotSupported_ByRefLike = "NotSupported_ByRefLike"; - - public const string NotSupported_ByRefToByRefLikeReturn = "NotSupported_ByRefToByRefLikeReturn"; - - public const string NotSupported_ByRefToVoidReturn = "NotSupported_ByRefToVoidReturn"; - - public const string NotSupported_CallToVarArg = "NotSupported_CallToVarArg"; - - public const string NotSupported_CannotCallEqualsOnSpan = "NotSupported_CannotCallEqualsOnSpan"; - - public const string NotSupported_CannotCallGetHashCodeOnSpan = - "NotSupported_CannotCallGetHashCodeOnSpan"; - - public const string NotSupported_ChangeType = "NotSupported_ChangeType"; - - public const string NotSupported_CreateInstanceWithTypeBuilder = - "NotSupported_CreateInstanceWithTypeBuilder"; - - public const string NotSupported_DynamicAssembly = "NotSupported_DynamicAssembly"; - - public const string NotSupported_DynamicMethodFlags = "NotSupported_DynamicMethodFlags"; - - public const string NotSupported_DynamicModule = "NotSupported_DynamicModule"; - - public const string NotSupported_FixedSizeCollection = "NotSupported_FixedSizeCollection"; - - public const string InvalidOperation_SpanOverlappedOperation = - "InvalidOperation_SpanOverlappedOperation"; - - public const string InvalidOperation_TimeProviderNullLocalTimeZone = - "InvalidOperation_TimeProviderNullLocalTimeZone"; - - public const string InvalidOperation_TimeProviderInvalidTimestampFrequency = - "InvalidOperation_TimeProviderInvalidTimestampFrequency"; - - public const string NotSupported_IllegalOneByteBranch = "NotSupported_IllegalOneByteBranch"; - - public const string NotSupported_KeyCollectionSet = "NotSupported_KeyCollectionSet"; - - public const string NotSupported_MaxWaitHandles = "NotSupported_MaxWaitHandles"; - - public const string NotSupported_MemStreamNotExpandable = "NotSupported_MemStreamNotExpandable"; - - public const string NotSupported_MustBeModuleBuilder = "NotSupported_MustBeModuleBuilder"; - - public const string NotSupported_NoCodepageData = "NotSupported_NoCodepageData"; - - public const string InvalidOperation_FunctionMissingUnmanagedCallersOnly = - "InvalidOperation_FunctionMissingUnmanagedCallersOnly"; - - public const string NotSupported_NonReflectedType = "NotSupported_NonReflectedType"; - - public const string NotSupported_NoParentDefaultConstructor = - "NotSupported_NoParentDefaultConstructor"; - - public const string NotSupported_NoTypeInfo = "NotSupported_NoTypeInfo"; - - public const string NotSupported_NYI = "NotSupported_NYI"; - - public const string NotSupported_ObsoleteResourcesFile = "NotSupported_ObsoleteResourcesFile"; - - public const string NotSupported_OutputStreamUsingTypeBuilder = - "NotSupported_OutputStreamUsingTypeBuilder"; - - public const string NotSupported_RangeCollection = "NotSupported_RangeCollection"; - - public const string NotSupported_Reading = "NotSupported_Reading"; - - public const string NotSupported_ReadOnlyCollection = "NotSupported_ReadOnlyCollection"; - - public const string NotSupported_ResourceObjectSerialization = - "NotSupported_ResourceObjectSerialization"; - - public const string NotSupported_StringComparison = "NotSupported_StringComparison"; - - public const string NotSupported_SubclassOverride = "NotSupported_SubclassOverride"; - - public const string NotSupported_SymbolMethod = "NotSupported_SymbolMethod"; - - public const string NotSupported_Type = "NotSupported_Type"; - - public const string NotSupported_TypeNotYetCreated = "NotSupported_TypeNotYetCreated"; - - public const string NotSupported_UmsSafeBuffer = "NotSupported_UmsSafeBuffer"; - - public const string NotSupported_UnitySerHolder = "NotSupported_UnitySerHolder"; - - public const string NotSupported_UnreadableStream = "NotSupported_UnreadableStream"; - - public const string NotSupported_UnseekableStream = "NotSupported_UnseekableStream"; - - public const string NotSupported_UnwritableStream = "NotSupported_UnwritableStream"; - - public const string NotSupported_ValueCollectionSet = "NotSupported_ValueCollectionSet"; - - public const string NotSupported_Writing = "NotSupported_Writing"; - - public const string NotSupported_WrongResourceReader_Type = - "NotSupported_WrongResourceReader_Type"; - - public const string ObjectDisposed_FileClosed = "ObjectDisposed_FileClosed"; - - public const string ObjectDisposed_Generic = "ObjectDisposed_Generic"; - - public const string ObjectDisposed_ObjectName_Name = "ObjectDisposed_ObjectName_Name"; - - public const string ObjectDisposed_WriterClosed = "ObjectDisposed_WriterClosed"; - - public const string ObjectDisposed_ReaderClosed = "ObjectDisposed_ReaderClosed"; - - public const string ObjectDisposed_ResourceSet = "ObjectDisposed_ResourceSet"; - - public const string ObjectDisposed_StreamClosed = "ObjectDisposed_StreamClosed"; - - public const string ObjectDisposed_ViewAccessorClosed = "ObjectDisposed_ViewAccessorClosed"; - - public const string OperationCanceled = "OperationCanceled"; - - public const string Overflow_Byte = "Overflow_Byte"; - - public const string Overflow_Char = "Overflow_Char"; - - public const string Overflow_Currency = "Overflow_Currency"; - - public const string Overflow_Decimal = "Overflow_Decimal"; - - public const string Overflow_Duration = "Overflow_Duration"; - - public const string Overflow_Int16 = "Overflow_Int16"; - - public const string Overflow_Int32 = "Overflow_Int32"; - - public const string Overflow_Int64 = "Overflow_Int64"; - - public const string Overflow_Int128 = "Overflow_Int128"; - - public const string Overflow_NegateTwosCompNum = "Overflow_NegateTwosCompNum"; - - public const string Overflow_NegativeUnsigned = "Overflow_NegativeUnsigned"; - - public const string Overflow_SByte = "Overflow_SByte"; - - public const string Overflow_TimeSpanElementTooLarge = "Overflow_TimeSpanElementTooLarge"; - - public const string Overflow_TimeSpanTooLong = "Overflow_TimeSpanTooLong"; - - public const string Overflow_UInt16 = "Overflow_UInt16"; - - public const string Overflow_UInt32 = "Overflow_UInt32"; - - public const string Overflow_UInt64 = "Overflow_UInt64"; - - public const string Overflow_UInt128 = "Overflow_UInt128"; - - public const string PlatformNotSupported_ArgIterator = "PlatformNotSupported_ArgIterator"; - - public const string PlatformNotSupported_ComInterop = "PlatformNotSupported_ComInterop"; - - public const string PlatformNotSupported_NamedSynchronizationPrimitives = - "PlatformNotSupported_NamedSynchronizationPrimitives"; - - public const string PlatformNotSupported_OSXFileLocking = "PlatformNotSupported_OSXFileLocking"; - - public const string PlatformNotSupported_ReflectionOnly = "PlatformNotSupported_ReflectionOnly"; - - public const string PlatformNotSupported_Remoting = "PlatformNotSupported_Remoting"; - - public const string PlatformNotSupported_SecureBinarySerialization = - "PlatformNotSupported_SecureBinarySerialization"; - - public const string PlatformNotSupported_StrongNameSigning = - "PlatformNotSupported_StrongNameSigning"; - - public const string PlatformNotSupported_OverlappedIO = "PlatformNotSupported_OverlappedIO"; - - public const string PlatformNotSupported_AppDomains = "PlatformNotSupported_AppDomains"; - - public const string PlatformNotSupported_CAS = "PlatformNotSupported_CAS"; - - public const string PlatformNotSupported_Principal = "PlatformNotSupported_Principal"; - - public const string PlatformNotSupported_ThreadAbort = "PlatformNotSupported_ThreadAbort"; - - public const string PlatformNotSupported_ThreadSuspend = "PlatformNotSupported_ThreadSuspend"; - - public const string PostconditionFailed = "PostconditionFailed"; - - public const string PostconditionFailed_Cnd = "PostconditionFailed_Cnd"; - - public const string PostconditionOnExceptionFailed = "PostconditionOnExceptionFailed"; - - public const string PostconditionOnExceptionFailed_Cnd = "PostconditionOnExceptionFailed_Cnd"; - - public const string PreconditionFailed = "PreconditionFailed"; - - public const string PreconditionFailed_Cnd = "PreconditionFailed_Cnd"; - - public const string Rank_MultiDimNotSupported = "Rank_MultiDimNotSupported"; - - public const string Rank_MustMatch = "Rank_MustMatch"; - - public const string ResourceReaderIsClosed = "ResourceReaderIsClosed"; - - public const string Resources_StreamNotValid = "Resources_StreamNotValid"; - - public const string RFLCT_AmbigCust = "RFLCT_AmbigCust"; - - public const string InvalidFilterCriteriaException_CritInt = - "InvalidFilterCriteriaException_CritInt"; - - public const string InvalidFilterCriteriaException_CritString = - "InvalidFilterCriteriaException_CritString"; - - public const string RFLCT_InvalidFieldFail = "RFLCT_InvalidFieldFail"; - - public const string RFLCT_InvalidPropFail = "RFLCT_InvalidPropFail"; - - public const string RFLCT_Targ_ITargMismatch = "RFLCT_Targ_ITargMismatch"; - - public const string RFLCT_Targ_StatFldReqTarg = "RFLCT_Targ_StatFldReqTarg"; - - public const string RFLCT_Targ_StatMethReqTarg = "RFLCT_Targ_StatMethReqTarg"; - - public const string RuntimeWrappedException = "RuntimeWrappedException"; - - public const string Security_CannotReadFileData = "Security_CannotReadFileData"; - - public const string SemaphoreSlim_ctor_InitialCountWrong = - "SemaphoreSlim_ctor_InitialCountWrong"; - - public const string SemaphoreSlim_ctor_MaxCountWrong = "SemaphoreSlim_ctor_MaxCountWrong"; - - public const string SemaphoreSlim_Release_CountWrong = "SemaphoreSlim_Release_CountWrong"; - - public const string SemaphoreSlim_Wait_TimeoutWrong = "SemaphoreSlim_Wait_TimeoutWrong"; - - public const string Serialization_BadParameterInfo = "Serialization_BadParameterInfo"; - - public const string Serialization_CorruptField = "Serialization_CorruptField"; - - public const string Serialization_DateTimeTicksOutOfRange = - "Serialization_DateTimeTicksOutOfRange"; - - public const string Serialization_DelegatesNotSupported = "Serialization_DelegatesNotSupported"; - - public const string Serialization_InsufficientState = "Serialization_InsufficientState"; - - public const string Serialization_InvalidData = "Serialization_InvalidData"; - - public const string Serialization_InvalidEscapeSequence = "Serialization_InvalidEscapeSequence"; - - public const string Serialization_InvalidOnDeser = "Serialization_InvalidOnDeser"; - - public const string Serialization_InvalidType = "Serialization_InvalidType"; - - public const string Serialization_KeyValueDifferentSizes = - "Serialization_KeyValueDifferentSizes"; - - public const string Serialization_MissingDateTimeData = "Serialization_MissingDateTimeData"; - - public const string Serialization_MissingKeys = "Serialization_MissingKeys"; - - public const string Serialization_MissingValues = "Serialization_MissingValues"; - - public const string Serialization_NoParameterInfo = "Serialization_NoParameterInfo"; - - public const string Serialization_NotFound = "Serialization_NotFound"; - - public const string Serialization_NullKey = "Serialization_NullKey"; - - public const string Serialization_OptionalFieldVersionValue = - "Serialization_OptionalFieldVersionValue"; - - public const string Serialization_SameNameTwice = "Serialization_SameNameTwice"; - - public const string Serialization_StringBuilderCapacity = "Serialization_StringBuilderCapacity"; - - public const string Serialization_StringBuilderMaxCapacity = - "Serialization_StringBuilderMaxCapacity"; - - public const string SpinLock_Exit_SynchronizationLockException = - "SpinLock_Exit_SynchronizationLockException"; - - public const string SpinLock_IsHeldByCurrentThread = "SpinLock_IsHeldByCurrentThread"; - - public const string SpinLock_TryEnter_ArgumentOutOfRange = - "SpinLock_TryEnter_ArgumentOutOfRange"; - - public const string SpinLock_TryEnter_LockRecursionException = - "SpinLock_TryEnter_LockRecursionException"; - - public const string SpinLock_TryReliableEnter_ArgumentException = - "SpinLock_TryReliableEnter_ArgumentException"; - - public const string SpinWait_SpinUntil_TimeoutWrong = "SpinWait_SpinUntil_TimeoutWrong"; - - public const string Task_ContinueWith_ESandLR = "Task_ContinueWith_ESandLR"; - - public const string Task_ContinueWith_NotOnAnything = "Task_ContinueWith_NotOnAnything"; - - public const string Task_InvalidTimerTimeSpan = "Task_InvalidTimerTimeSpan"; - - public const string Task_Delay_InvalidMillisecondsDelay = "Task_Delay_InvalidMillisecondsDelay"; - - public const string Task_Dispose_NotCompleted = "Task_Dispose_NotCompleted"; - - public const string Task_FromAsync_LongRunning = "Task_FromAsync_LongRunning"; - - public const string Task_FromAsync_PreferFairness = "Task_FromAsync_PreferFairness"; - - public const string Task_MultiTaskContinuation_EmptyTaskList = - "Task_MultiTaskContinuation_EmptyTaskList"; - - public const string Task_MultiTaskContinuation_FireOptions = - "Task_MultiTaskContinuation_FireOptions"; - - public const string Task_MultiTaskContinuation_NullTask = "Task_MultiTaskContinuation_NullTask"; - - public const string Task_RunSynchronously_AlreadyStarted = - "Task_RunSynchronously_AlreadyStarted"; - - public const string Task_RunSynchronously_Continuation = "Task_RunSynchronously_Continuation"; - - public const string Task_RunSynchronously_Promise = "Task_RunSynchronously_Promise"; - - public const string Task_RunSynchronously_TaskCompleted = "Task_RunSynchronously_TaskCompleted"; - - public const string Task_Start_AlreadyStarted = "Task_Start_AlreadyStarted"; - - public const string Task_Start_ContinuationTask = "Task_Start_ContinuationTask"; - - public const string Task_Start_Promise = "Task_Start_Promise"; - - public const string Task_Start_TaskCompleted = "Task_Start_TaskCompleted"; - - public const string Task_ThrowIfDisposed = "Task_ThrowIfDisposed"; - - public const string Task_WaitMulti_NullTask = "Task_WaitMulti_NullTask"; - - public const string TaskCanceledException_ctor_DefaultMessage = - "TaskCanceledException_ctor_DefaultMessage"; - - public const string TaskCompletionSourceT_TrySetException_NoExceptions = - "TaskCompletionSourceT_TrySetException_NoExceptions"; - - public const string TaskCompletionSourceT_TrySetException_NullException = - "TaskCompletionSourceT_TrySetException_NullException"; - - public const string TaskExceptionHolder_UnhandledException = - "TaskExceptionHolder_UnhandledException"; - - public const string TaskExceptionHolder_UnknownExceptionType = - "TaskExceptionHolder_UnknownExceptionType"; - - public const string TaskScheduler_ExecuteTask_WrongTaskScheduler = - "TaskScheduler_ExecuteTask_WrongTaskScheduler"; - - public const string TaskScheduler_FromCurrentSynchronizationContext_NoCurrent = - "TaskScheduler_FromCurrentSynchronizationContext_NoCurrent"; - - public const string TaskScheduler_InconsistentStateAfterTryExecuteTaskInline = - "TaskScheduler_InconsistentStateAfterTryExecuteTaskInline"; - - public const string TaskSchedulerException_ctor_DefaultMessage = - "TaskSchedulerException_ctor_DefaultMessage"; - - public const string TaskT_DebuggerNoResult = "TaskT_DebuggerNoResult"; - - public const string TaskT_TransitionToFinal_AlreadyCompleted = - "TaskT_TransitionToFinal_AlreadyCompleted"; - - public const string Thread_GetSetCompressedStack_NotSupported = - "Thread_GetSetCompressedStack_NotSupported"; - - public const string Thread_Operation_RequiresCurrentThread = - "Thread_Operation_RequiresCurrentThread"; - - public const string Threading_AbandonedMutexException = "Threading_AbandonedMutexException"; - - public const string Threading_WaitHandleCannotBeOpenedException = - "Threading_WaitHandleCannotBeOpenedException"; - - public const string Threading_WaitHandleCannotBeOpenedException_InvalidHandle = - "Threading_WaitHandleCannotBeOpenedException_InvalidHandle"; - - public const string Threading_WaitHandleTooManyPosts = "Threading_WaitHandleTooManyPosts"; - - public const string Threading_SemaphoreFullException = "Threading_SemaphoreFullException"; - - public const string ThreadLocal_Value_RecursiveCallsToValue = - "ThreadLocal_Value_RecursiveCallsToValue"; - - public const string ThreadLocal_ValuesNotAvailable = "ThreadLocal_ValuesNotAvailable"; - - public const string TimeZoneNotFound_MissingData = "TimeZoneNotFound_MissingData"; - - public const string TypeInitialization_Default = "TypeInitialization_Default"; - - public const string TypeInitialization_Type = "TypeInitialization_Type"; - - public const string TypeLoad_ResolveNestedType = "TypeLoad_ResolveNestedType"; - - public const string TypeLoad_ResolveType = "TypeLoad_ResolveType"; - - public const string TypeLoad_ResolveTypeFromAssembly = "TypeLoad_ResolveTypeFromAssembly"; - - public const string UnauthorizedAccess_IODenied_NoPathName = - "UnauthorizedAccess_IODenied_NoPathName"; - - public const string UnauthorizedAccess_IODenied_Path = "UnauthorizedAccess_IODenied_Path"; - - public const string UnauthorizedAccess_MemStreamBuffer = "UnauthorizedAccess_MemStreamBuffer"; - - public const string Verification_Exception = "Verification_Exception"; - - public const string DebugAssertBanner = "DebugAssertBanner"; - - public const string DebugAssertLongMessage = "DebugAssertLongMessage"; - - public const string DebugAssertShortMessage = "DebugAssertShortMessage"; - - public const string LockRecursionException_ReadAfterWriteNotAllowed = - "LockRecursionException_ReadAfterWriteNotAllowed"; - - public const string LockRecursionException_RecursiveReadNotAllowed = - "LockRecursionException_RecursiveReadNotAllowed"; - - public const string LockRecursionException_RecursiveWriteNotAllowed = - "LockRecursionException_RecursiveWriteNotAllowed"; - - public const string LockRecursionException_RecursiveUpgradeNotAllowed = - "LockRecursionException_RecursiveUpgradeNotAllowed"; - - public const string LockRecursionException_WriteAfterReadNotAllowed = - "LockRecursionException_WriteAfterReadNotAllowed"; - - public const string SynchronizationLockException_MisMatchedUpgrade = - "SynchronizationLockException_MisMatchedUpgrade"; - - public const string SynchronizationLockException_MisMatchedRead = - "SynchronizationLockException_MisMatchedRead"; - - public const string SynchronizationLockException_IncorrectDispose = - "SynchronizationLockException_IncorrectDispose"; - - public const string LockRecursionException_UpgradeAfterReadNotAllowed = - "LockRecursionException_UpgradeAfterReadNotAllowed"; - - public const string LockRecursionException_UpgradeAfterWriteNotAllowed = - "LockRecursionException_UpgradeAfterWriteNotAllowed"; - - public const string SynchronizationLockException_MisMatchedWrite = - "SynchronizationLockException_MisMatchedWrite"; - - public const string NotSupported_SignatureType = "NotSupported_SignatureType"; - - public const string HashCode_HashCodeNotSupported = "HashCode_HashCodeNotSupported"; - - public const string HashCode_EqualityNotSupported = "HashCode_EqualityNotSupported"; - - public const string Arg_TypeNotSupported = "Arg_TypeNotSupported"; - - public const string IO_InvalidReadLength = "IO_InvalidReadLength"; - - public const string Arg_BasePathNotFullyQualified = "Arg_BasePathNotFullyQualified"; - - public const string Argument_AggressiveGCRequiresMaxGeneration = - "Argument_AggressiveGCRequiresMaxGeneration"; - - public const string Argument_AggressiveGCRequiresBlocking = - "Argument_AggressiveGCRequiresBlocking"; - - public const string Argument_AggressiveGCRequiresCompacting = - "Argument_AggressiveGCRequiresCompacting"; - - public const string Argument_OverlapAlignmentMismatch = "Argument_OverlapAlignmentMismatch"; - - public const string Arg_MustBeNullTerminatedString = "Arg_MustBeNullTerminatedString"; - - public const string ArgumentOutOfRange_Week_ISO = "ArgumentOutOfRange_Week_ISO"; - - public const string Argument_BadPInvokeMethod = "Argument_BadPInvokeMethod"; - - public const string Argument_BadPInvokeOnInterface = "Argument_BadPInvokeOnInterface"; - - public const string Argument_MethodRedefined = "Argument_MethodRedefined"; - - public const string Argument_CannotExtractScalar = "Argument_CannotExtractScalar"; - - public const string Argument_CannotParsePrecision = "Argument_CannotParsePrecision"; - - public const string Argument_GWithPrecisionNotSupported = "Argument_GWithPrecisionNotSupported"; - - public const string Argument_PrecisionTooLarge = "Argument_PrecisionTooLarge"; - - public const string AssemblyDependencyResolver_FailedToLoadHostpolicy = - "AssemblyDependencyResolver_FailedToLoadHostpolicy"; - - public const string AssemblyDependencyResolver_FailedToResolveDependencies = - "AssemblyDependencyResolver_FailedToResolveDependencies"; - - public const string Argument_StructArrayTooLarge = "Argument_StructArrayTooLarge"; - - public const string IndexOutOfRange_ArrayWithOffset = "IndexOutOfRange_ArrayWithOffset"; - - public const string Serialization_DangerousDeserialization_Switch = - "Serialization_DangerousDeserialization_Switch"; - - public const string Argument_InvalidStartupHookSimpleAssemblyName = - "Argument_InvalidStartupHookSimpleAssemblyName"; - - public const string Argument_StartupHookAssemblyLoadFailed = - "Argument_StartupHookAssemblyLoadFailed"; - - public const string InvalidOperation_ResetGlobalComWrappersInstance = - "InvalidOperation_ResetGlobalComWrappersInstance"; - - public const string InvalidOperation_ResetGlobalObjectiveCMsgSend = - "InvalidOperation_ResetGlobalObjectiveCMsgSend"; - - public const string InvalidOperation_ReinitializeObjectiveCMarshal = - "InvalidOperation_ReinitializeObjectiveCMarshal"; - - public const string InvalidOperation_SuppliedInnerMustBeMarkedAggregation = - "InvalidOperation_SuppliedInnerMustBeMarkedAggregation"; - - public const string InvalidOperationException_NoGCRegionCallbackAlreadyRegistered = - "InvalidOperationException_NoGCRegionCallbackAlreadyRegistered"; - - public const string Argument_SpansMustHaveSameLength = "Argument_SpansMustHaveSameLength"; - - public const string NotSupported_CannotWriteToBufferedStreamIfReadBufferCannotBeFlushed = - "NotSupported_CannotWriteToBufferedStreamIfReadBufferCannotBeFlushed"; - - public const string GenericInvalidData = "GenericInvalidData"; - - public const string Argument_ResourceScopeWrongDirection = - "Argument_ResourceScopeWrongDirection"; - - public const string ArgumentNull_TypeRequiredByResourceScope = - "ArgumentNull_TypeRequiredByResourceScope"; - - public const string Argument_BadResourceScopeTypeBits = "Argument_BadResourceScopeTypeBits"; - - public const string Argument_BadResourceScopeVisibilityBits = - "Argument_BadResourceScopeVisibilityBits"; - - public const string Argument_EmptyString = "Argument_EmptyString"; - - public const string Argument_EmptyOrWhiteSpaceString = "Argument_EmptyOrWhiteSpaceString"; - - public const string Argument_FrameworkNameInvalid = "Argument_FrameworkNameInvalid"; - - public const string Argument_FrameworkNameInvalidVersion = - "Argument_FrameworkNameInvalidVersion"; - - public const string Argument_FrameworkNameMissingVersion = - "Argument_FrameworkNameMissingVersion"; - - public const string Argument_FrameworkNameTooShort = "Argument_FrameworkNameTooShort"; - - public const string Arg_SwitchExpressionException = "Arg_SwitchExpressionException"; - - public const string Arg_ContextMarshalException = "Arg_ContextMarshalException"; - - public const string Arg_AppDomainUnloadedException = "Arg_AppDomainUnloadedException"; - - public const string SwitchExpressionException_UnmatchedValue = - "SwitchExpressionException_UnmatchedValue"; - - public const string Encoding_UTF7_Disabled = "Encoding_UTF7_Disabled"; - - public const string IDynamicInterfaceCastable_DoesNotImplementRequested = - "IDynamicInterfaceCastable_DoesNotImplementRequested"; - - public const string IDynamicInterfaceCastable_MissingImplementationAttribute = - "IDynamicInterfaceCastable_MissingImplementationAttribute"; - - public const string IDynamicInterfaceCastable_NotInterface = - "IDynamicInterfaceCastable_NotInterface"; - - public const string Arg_MustBeHalf = "Arg_MustBeHalf"; - - public const string Arg_MustBeRune = "Arg_MustBeRune"; - - public const string BinaryFormatter_SerializationDisallowed = - "BinaryFormatter_SerializationDisallowed"; - - public const string NotSupported_CodeBase = "NotSupported_CodeBase"; - - public const string Activator_CannotCreateInstance = "Activator_CannotCreateInstance"; - - public const string ResourceManager_ReflectionNotAllowed = - "ResourceManager_ReflectionNotAllowed"; - - public const string InvalidOperation_EmptyQueue = "InvalidOperation_EmptyQueue"; - - public const string Arg_FileIsDirectory_Name = "Arg_FileIsDirectory_Name"; - - public const string Arg_InvalidFileAttrs = "Arg_InvalidFileAttrs"; - - public const string Arg_InvalidUnixFileMode = "Arg_InvalidUnixFileMode"; - - public const string Arg_Path2IsRooted = "Arg_Path2IsRooted"; - - public const string Argument_InvalidSubPath = "Argument_InvalidSubPath"; - - public const string IO_CannotReplaceSameFile = "IO_CannotReplaceSameFile"; - - public const string IO_NotAFile = "IO_NotAFile"; - - public const string IO_SourceDestMustBeDifferent = "IO_SourceDestMustBeDifferent"; - - public const string PlatformNotSupported_FileEncryption = "PlatformNotSupported_FileEncryption"; - - public const string Arg_MemberInfoNotFound = "Arg_MemberInfoNotFound"; - - public const string NullabilityInfoContext_NotSupported = "NullabilityInfoContext_NotSupported"; - - public const string NullReference_InvokeNullRefReturned = "NullReference_InvokeNullRefReturned"; - - public const string ArgumentOutOfRangeException_NoGCRegionSizeTooLarge = - "ArgumentOutOfRangeException_NoGCRegionSizeTooLarge"; - - public const string InvalidOperationException_AlreadyInNoGCRegion = - "InvalidOperationException_AlreadyInNoGCRegion"; - - public const string InvalidOperationException_NoGCRegionAllocationExceeded = - "InvalidOperationException_NoGCRegionAllocationExceeded"; - - public const string InvalidOperationException_NoGCRegionInduced = - "InvalidOperationException_NoGCRegionInduced"; - - public const string InvalidOperationException_NoGCRegionNotInProgress = - "InvalidOperationException_NoGCRegionNotInProgress"; - - public const string InvalidOperationException_HardLimitTooLow = - "InvalidOperationException_HardLimitTooLow"; - - public const string InvalidOperationException_HardLimitInvalid = - "InvalidOperationException_HardLimitInvalid"; - - public const string PlatformNotSupported_ReflectionEmit = "PlatformNotSupported_ReflectionEmit"; - - public const string Security_InvalidAssemblyPublicKey = "Security_InvalidAssemblyPublicKey"; - - public const string ClassLoad_General = "ClassLoad_General"; - - public const string ArgumentOutOfRange_NotGreaterThanBufferLength = - "ArgumentOutOfRange_NotGreaterThanBufferLength"; - - public const string Argument_AssemblyGetTypeCannotSpecifyAssembly = - "Argument_AssemblyGetTypeCannotSpecifyAssembly"; - - public const string Argument_DirectorySeparatorInvalid = "Argument_DirectorySeparatorInvalid"; - - public const string InvalidOperation_NotFunctionPointer = "InvalidOperation_NotFunctionPointer"; - - public const string NotSupported_ModifiedType = "NotSupported_ModifiedType"; - - public const string Argument_UnexpectedStateForKnownCallback = - "Argument_UnexpectedStateForKnownCallback"; - - public const string OutOfMemory_StringTooLong = "OutOfMemory_StringTooLong"; - - // static string key - // { - // if (key.Length == 0) - // { - // return key; - // } - // bool lockTaken = false; - // try - // { - // Monitor.Enter(_lock, ref lockTaken); - // if (_currentlyLoading != null && _currentlyLoading.Count > 0 && _currentlyLoading.LastIndexOf(key) >= 0) - // { - // if (_infinitelyRecursingCount > 0) - // { - // return key; - // } - // _infinitelyRecursingCount++; - // var message = $"Encountered infinite recursion while looking up resource '{key}' in System.Private.CoreLib. Verify the installation of .NET is complete and does not need repairing, and that the state of the process has not become corrupted."; - // Environment.FailFast(message); - // } - // if (_currentlyLoading == null) - // { - // _currentlyLoading = new List(); - // } - // if (!_resourceManagerInited) - // { - // RuntimeHelpers.RunClassConstructor(typeof(ResourceManager)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(ResourceReader)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(RuntimeResourceSet)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(BinaryReader)!.TypeHandle); - // _resourceManagerInited = true; - // } - // _currentlyLoading.Add(key); - // string @string = ResourceManager.GetString(key, null); - // _currentlyLoading.RemoveAt(_currentlyLoading.Count - 1); - // return @string ?? key; - // } - // catch - // { - // if (lockTaken) - // { - // s_resourceManager = null; - // _currentlyLoading = null; - // } - // throw; - // } - // finally - // { - // if (lockTaken) - // { - // Monitor.Exit(_lock); - // } - // } - // } - - // static bool UsingResourceKeys() - // { - // return s_usingResourceKeys; - // } - - // static string resourceKey - // { - // if (UsingResourceKeys()) - // { - // return resourceKey; - // } - // string result = null; - // try - // { - // result = InternalresourceKey; - // return result; - // } - // catch (MissingManifestResourceException) - // { - // return result; - // } - // } - // static string key - // { - // if (key.Length == 0) - // { - // return key; - // } - // bool lockTaken = false; - // try - // { - // Monitor.Enter(_lock, ref lockTaken); - // if (_currentlyLoading != null && _currentlyLoading.Count > 0 && _currentlyLoading.LastIndexOf(key) >= 0) - // { - // if (_infinitelyRecursingCount > 0) - // { - // return key; - // } - // _infinitelyRecursingCount++; - // var message = $"Encountered infinite recursion while looking up resource '{key}' in System.Private.CoreLib. Verify the installation of .NET is complete and does not need repairing, and that the state of the process has not become corrupted."; - // Environment.FailFast(message); - // } - // if (_currentlyLoading == null) - // { - // _currentlyLoading = new List(); - // } - // if (!_resourceManagerInited) - // { - // RuntimeHelpers.RunClassConstructor(typeof(ResourceManager)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(ResourceReader)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(RuntimeResourceSet)!.TypeHandle); - // RuntimeHelpers.RunClassConstructor(typeof(BinaryReader)!.TypeHandle); - // _resourceManagerInited = true; - // } - // _currentlyLoading.Add(key); - // string @string = ResourceManager.GetString(key, null); - // _currentlyLoading.RemoveAt(_currentlyLoading.Count - 1); - // return @string ?? key; - // } - // catch - // { - // if (lockTaken) - // { - // s_resourceManager = null; - // _currentlyLoading = null; - // } - // throw; - // } - // finally - // { - // if (lockTaken) - // { - // Monitor.Exit(_lock); - // } - // } - // } - - // static bool UsingResourceKeys() - // { - // return s_usingResourceKeys; - // } - - // static string resourceKey - // { - // if (UsingResourceKeys()) - // { - // return resourceKey; - // } - // string result = null; - // try - // { - // result = InternalresourceKey; - // return result; - // } - // catch (MissingManifestResourceException) - // { - // return result; - // } - - public static string Format(string resourceKey, string defaultString) - { - string resourceString = resourceKey; - if (!(resourceKey == resourceString) && resourceString != null) - { - return resourceString; - } - return defaultString; - } - - public static string Format(string resourceFormat, object p1) - { - if (UsingResourceKeys()) - { - return string.Join(", ", resourceFormat, p1); - } - return string.Format(resourceFormat, p1); - } - - public static string Format(string resourceFormat, object p1, object p2) - { - if (UsingResourceKeys()) - { - return string.Join(", ", resourceFormat, p1, p2); - } - return string.Format(resourceFormat, p1, p2); - } - - public 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); - } - - 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; - } - - static string Format(IFormatProvider provider, string resourceFormat, object p1) - { - if (UsingResourceKeys()) - { - return string.Join(", ", resourceFormat, p1); - } - return string.Format(provider, resourceFormat, p1); - } - - 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); - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/SpanHelper.cs b/src/PRE_NET6_0_POLYFILLS/SpanHelper.cs deleted file mode 100644 index dcdb77a..0000000 --- a/src/PRE_NET6_0_POLYFILLS/SpanHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -#if !NET6_0_OR_GREATER -namespace System; - -internal static class SpanHelper -{ - public static long DigitsToInt64(int value, int length) - { - long result = 0; - int multiplier = 1; - - for (int i = 0; i < length; i++) - { - int digit = value % 10; - result += digit * multiplier; - multiplier *= 10; - value /= 10; - } - - return result; - } - - public static int ParseDigits(ReadOnlySpan span, int startIndex, int length) - { - int result = 0; - - for (int i = startIndex; i < startIndex + length; i++) - { - char c = span[i]; - if (c < '0' || c > '9') - { - throw new FormatException("Invalid digit in input span."); - } - - result = result * 10 + (c - '0'); - } - - return result; - } - - public static int ParseDigits(ReadOnlySpan span, int startIndex, int length) - { - int result = 0; - - for (int i = startIndex; i < startIndex + length; i++) - { - byte b = span[i]; - if (b < '0' || b > '9') - { - throw new FormatException("Invalid digit in input span."); - } - - result = result * 10 + (b - '0'); - } - - return result; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/ThrowHelper.cs b/src/PRE_NET6_0_POLYFILLS/ThrowHelper.cs deleted file mode 100644 index b1bb9b2..0000000 --- a/src/PRE_NET6_0_POLYFILLS/ThrowHelper.cs +++ /dev/null @@ -1,935 +0,0 @@ -#if !NET6_0_OR_GREATER -#region Assembly System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e -// /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.5.23280.8/System.Private.CoreLib.dll -// Decompiled with ICSharpCode.Decompiler 7.2.1.6856 -#endregion - -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Numerics; -using System.Runtime.CompilerServices; -// using System.Runtime.Intrinsics; -using System.Runtime.Serialization; - -namespace System; - -// [StackTraceHidden] -internal static class ThrowHelper -{ - [DoesNotReturn] - internal static void ThrowAccessViolationException() - { - throw new AccessViolationException(); - } - - [DoesNotReturn] - internal static void ThrowArrayTypeMismatchException() - { - throw new ArrayTypeMismatchException(); - } - - [DoesNotReturn] - internal static void ThrowInvalidTypeWithPointersNotSupported(Type targetType) - { - throw new ArgumentException( - SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, targetType) - ); - } - - [DoesNotReturn] - internal static void ThrowIndexOutOfRangeException() - { - throw new IndexOutOfRangeException(); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException() - { - throw new ArgumentOutOfRangeException(); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_DestinationTooShort() - { - throw new ArgumentException(SR.Argument_DestinationTooShort, "destination"); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_OverlapAlignmentMismatch() - { - throw new ArgumentException(SR.Argument_OverlapAlignmentMismatch); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_ArgumentNull_TypedRefType() - { - throw new ArgumentNullException("value", SR.ArgumentNull_TypedRefType); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_CannotExtractScalar(ExceptionArgument argument) - { - throw GetArgumentException(ExceptionResource.Argument_CannotExtractScalar, argument); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_TupleIncorrectType(object obj) - { - throw new ArgumentException( - SR.Format(SR.ArgumentException_ValueTupleIncorrectType, obj.GetType()), - "other" - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_IndexMustBeLessException() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.index, - ExceptionResource.ArgumentOutOfRange_IndexMustBeLess - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_IndexMustBeLessOrEqualException() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.index, - ExceptionResource.ArgumentOutOfRange_IndexMustBeLessOrEqual - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_BadComparer(object comparer) - { - throw new ArgumentException(SR.Format(SR.Arg_BogusIComparer, comparer)); - } - - [DoesNotReturn] - internal static void ThrowIndexArgumentOutOfRange_NeedNonNegNumException() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.index, - ExceptionResource.ArgumentOutOfRange_NeedNonNegNum - ); - } - - [DoesNotReturn] - internal static void ThrowValueArgumentOutOfRange_NeedNonNegNumException() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.value, - ExceptionResource.ArgumentOutOfRange_NeedNonNegNum - ); - } - - [DoesNotReturn] - internal static void ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.length, - ExceptionResource.ArgumentOutOfRange_NeedNonNegNum - ); - } - - [DoesNotReturn] - internal static void ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_IndexMustBeLessOrEqual() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.startIndex, - ExceptionResource.ArgumentOutOfRange_IndexMustBeLessOrEqual - ); - } - - [DoesNotReturn] - internal static void ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_IndexMustBeLess() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.startIndex, - ExceptionResource.ArgumentOutOfRange_IndexMustBeLess - ); - } - - [DoesNotReturn] - internal static void ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.count, - ExceptionResource.ArgumentOutOfRange_Count - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_Year() - { - throw GetArgumentOutOfRangeException( - ExceptionArgument.year, - ExceptionResource.ArgumentOutOfRange_Year - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_Month(int month) - { - throw new ArgumentOutOfRangeException("month", month, SR.ArgumentOutOfRange_Month); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_DayNumber(int dayNumber) - { - throw new ArgumentOutOfRangeException( - "dayNumber", - dayNumber, - SR.ArgumentOutOfRange_DayNumber - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_BadYearMonthDay() - { - throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_BadHourMinuteSecond() - { - throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_TimeSpanTooLong() - { - throw new ArgumentOutOfRangeException(null, SR.Overflow_TimeSpanTooLong); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRange_Range( - string parameterName, - T value, - T minInclusive, - T maxInclusive - ) - { - throw new ArgumentOutOfRangeException( - parameterName, - value, - SR.Format(SR.ArgumentOutOfRange_Range, minInclusive, maxInclusive) - ); - } - - [DoesNotReturn] - internal static void ThrowOverflowException() - { - throw new OverflowException(); - } - - [DoesNotReturn] - internal static void ThrowOverflowException_TimeSpanTooLong() - { - throw new OverflowException(SR.Overflow_TimeSpanTooLong); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_Arg_CannotBeNaN() - { - throw new ArgumentException(SR.Arg_CannotBeNaN); - } - - [DoesNotReturn] - internal static void ThrowWrongKeyTypeArgumentException(T key, Type targetType) - { - throw GetWrongKeyTypeArgumentException(key, targetType); - } - - [DoesNotReturn] - internal static void ThrowWrongValueTypeArgumentException(T value, Type targetType) - { - throw GetWrongValueTypeArgumentException(value, targetType); - } - - private static ArgumentException GetAddingDuplicateWithKeyArgumentException(object key) - { - return new ArgumentException(SR.Format(SR.Argument_AddingDuplicateWithKey, key)); - } - - [DoesNotReturn] - internal static void ThrowAddingDuplicateWithKeyArgumentException(T key) - { - throw GetAddingDuplicateWithKeyArgumentException(key); - } - - [DoesNotReturn] - internal static void ThrowKeyNotFoundException(T key) - { - throw GetKeyNotFoundException(key); - } - - [DoesNotReturn] - internal static void ThrowArgumentException(ExceptionResource resource) - { - throw GetArgumentException(resource); - } - - [DoesNotReturn] - internal static void ThrowArgumentException( - ExceptionResource resource, - ExceptionArgument argument - ) - { - throw GetArgumentException(resource, argument); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_HandleNotSync(string paramName) - { - throw new ArgumentException(SR.Arg_HandleNotSync, paramName); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_HandleNotAsync(string paramName) - { - throw new ArgumentException(SR.Arg_HandleNotAsync, paramName); - } - - [DoesNotReturn] - internal static void ThrowArgumentNullException(ExceptionArgument argument) - { - throw new ArgumentNullException(GetArgumentName(argument)); - } - - [DoesNotReturn] - internal static void ThrowArgumentNullException( - ExceptionArgument argument, - ExceptionResource resource - ) - { - throw new ArgumentNullException(GetArgumentName(argument), GetResourceString(resource)); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) - { - throw new ArgumentOutOfRangeException(GetArgumentName(argument)); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException( - ExceptionArgument argument, - ExceptionResource resource - ) - { - throw GetArgumentOutOfRangeException(argument, resource); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException( - ExceptionArgument argument, - int paramNumber, - ExceptionResource resource - ) - { - throw GetArgumentOutOfRangeException(argument, paramNumber, resource); - } - - [DoesNotReturn] - internal static void ThrowEndOfFileException() - { - throw CreateEndOfFileException(); - } - - internal static Exception CreateEndOfFileException() - { - return new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException() - { - throw new InvalidOperationException(); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException(ExceptionResource resource) - { - throw GetInvalidOperationException(resource); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException(ExceptionResource resource, Exception e) - { - throw new InvalidOperationException(GetResourceString(resource), e); - } - - [DoesNotReturn] - internal static void ThrowSerializationException(ExceptionResource resource) - { - throw new SerializationException(GetResourceString(resource)); - } - - [DoesNotReturn] - internal static void ThrowRankException(ExceptionResource resource) - { - throw new RankException(GetResourceString(resource)); - } - - [DoesNotReturn] - internal static void ThrowNotSupportedException(ExceptionResource resource) - { - throw new NotSupportedException(GetResourceString(resource)); - } - - [DoesNotReturn] - internal static void ThrowNotSupportedException_UnseekableStream() - { - throw new NotSupportedException(SR.NotSupported_UnseekableStream); - } - - [DoesNotReturn] - internal static void ThrowNotSupportedException_UnreadableStream() - { - throw new NotSupportedException(SR.NotSupported_UnreadableStream); - } - - [DoesNotReturn] - internal static void ThrowNotSupportedException_UnwritableStream() - { - throw new NotSupportedException(SR.NotSupported_UnwritableStream); - } - - [DoesNotReturn] - internal static void ThrowObjectDisposedException(object instance) - { - throw new ObjectDisposedException(instance?.GetType().FullName); - } - - [DoesNotReturn] - internal static void ThrowObjectDisposedException(Type type) - { - throw new ObjectDisposedException(type?.FullName); - } - - [DoesNotReturn] - internal static void ThrowObjectDisposedException_StreamClosed(string objectName) - { - throw new ObjectDisposedException(objectName, SR.ObjectDisposed_StreamClosed); - } - - [DoesNotReturn] - internal static void ThrowObjectDisposedException_FileClosed() - { - throw new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed); - } - - [DoesNotReturn] - internal static void ThrowObjectDisposedException(ExceptionResource resource) - { - throw new ObjectDisposedException(null, GetResourceString(resource)); - } - - [DoesNotReturn] - internal static void ThrowNotSupportedException() - { - throw new NotSupportedException(); - } - - [DoesNotReturn] - internal static void ThrowAggregateException(List exceptions) - { - throw new AggregateException(exceptions); - } - - [DoesNotReturn] - internal static void ThrowOutOfMemoryException() - { - throw new OutOfMemoryException(); - } - - [DoesNotReturn] - internal static void ThrowOutOfMemoryException_StringTooLong() - { - throw new OutOfMemoryException(SR.OutOfMemory_StringTooLong); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_Argument_IncompatibleArrayType() - { - throw new ArgumentException(SR.Argument_IncompatibleArrayType); - } - - [DoesNotReturn] - internal static void ThrowArgumentException_InvalidHandle(string paramName) - { - throw new ArgumentException(SR.Arg_InvalidHandle, paramName); - } - - [DoesNotReturn] - internal static void ThrowUnexpectedStateForKnownCallback(object state) - { - throw new ArgumentOutOfRangeException( - "state", - state, - SR.Argument_UnexpectedStateForKnownCallback - ); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_InvalidOperation_EnumNotStarted() - { - throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_InvalidOperation_EnumEnded() - { - throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_EnumCurrent(int index) - { - throw GetInvalidOperationException_EnumCurrent(index); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion() - { - throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen() - { - throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_InvalidOperation_NoValue() - { - throw new InvalidOperationException(SR.InvalidOperation_NoValue); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_ConcurrentOperationsNotSupported() - { - throw new InvalidOperationException(SR.InvalidOperation_ConcurrentOperationsNotSupported); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_HandleIsNotInitialized() - { - throw new InvalidOperationException(SR.InvalidOperation_HandleIsNotInitialized); - } - - [DoesNotReturn] - internal static void ThrowInvalidOperationException_HandleIsNotPinned() - { - throw new InvalidOperationException(SR.InvalidOperation_HandleIsNotPinned); - } - - [DoesNotReturn] - internal static void ThrowArraySegmentCtorValidationFailedExceptions( - Array array, - int offset, - int count - ) - { - throw GetArraySegmentCtorValidationFailedException(array, offset, count); - } - - [DoesNotReturn] - internal static void ThrowFormatException_BadFormatSpecifier() - { - throw new FormatException(SR.Argument_BadFormatSpecifier); - } - - [DoesNotReturn] - internal static void ThrowFormatException_NeedSingleChar() - { - throw new FormatException(SR.Format_NeedSingleChar); - } - - [DoesNotReturn] - internal static void ThrowFormatException_BadBoolean(ReadOnlySpan value) - { - throw new FormatException(SR.Format(SR.Format_BadBoolean, new string(value.ToArray()))); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException_PrecisionTooLarge() - { - throw new ArgumentOutOfRangeException( - "precision", - SR.Format(SR.Argument_PrecisionTooLarge, (byte)99) - ); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException_SymbolDoesNotFit() - { - throw new ArgumentOutOfRangeException("symbol", SR.Argument_BadFormatSpecifier); - } - - [DoesNotReturn] - internal static void ThrowArgumentOutOfRangeException_NeedNonNegNum(string paramName) - { - throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_NeedNonNegNum); - } - - [DoesNotReturn] - internal static void ArgumentOutOfRangeException_Enum_Value() - { - throw new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_Enum); - } - - [DoesNotReturn] - internal static void ThrowFormatInvalidString() - { - throw new FormatException(SR.Format_InvalidString); - } - - [DoesNotReturn] - internal static void ThrowFormatInvalidString(int offset, ExceptionResource resource) - { - throw new FormatException( - SR.Format( - SR.Format_InvalidStringWithOffsetAndReason, - offset, - GetResourceString(resource) - ) - ); - } - - [DoesNotReturn] - internal static void ThrowFormatIndexOutOfRange() - { - throw new FormatException(SR.Format_IndexOutOfRange); - } - - private static Exception GetArraySegmentCtorValidationFailedException( - Array array, - int offset, - int count - ) - { - if (array == null) - { - return new ArgumentNullException("array"); - } - if (offset < 0) - { - return new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_NeedNonNegNum); - } - if (count < 0) - { - return new ArgumentOutOfRangeException("count", SR.ArgumentOutOfRange_NeedNonNegNum); - } - return new ArgumentException(SR.Argument_InvalidOffLen); - } - - private static ArgumentException GetArgumentException(ExceptionResource resource) - { - return new ArgumentException(GetResourceString(resource)); - } - - private static InvalidOperationException GetInvalidOperationException( - ExceptionResource resource - ) - { - return new InvalidOperationException(GetResourceString(resource)); - } - - private static ArgumentException GetWrongKeyTypeArgumentException(object key, Type targetType) - { - return new ArgumentException(SR.Format(SR.Arg_WrongType, key, targetType), "key"); - } - - private static ArgumentException GetWrongValueTypeArgumentException( - object value, - Type targetType - ) - { - return new ArgumentException(SR.Format(SR.Arg_WrongType, value, targetType), "value"); - } - - private static KeyNotFoundException GetKeyNotFoundException(object key) - { - return new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key)); - } - - private static ArgumentOutOfRangeException GetArgumentOutOfRangeException( - ExceptionArgument argument, - ExceptionResource resource - ) - { - return new ArgumentOutOfRangeException( - GetArgumentName(argument), - GetResourceString(resource) - ); - } - - private static ArgumentException GetArgumentException( - ExceptionResource resource, - ExceptionArgument argument - ) - { - return new ArgumentException(GetResourceString(resource), GetArgumentName(argument)); - } - - private static ArgumentOutOfRangeException GetArgumentOutOfRangeException( - ExceptionArgument argument, - int paramNumber, - ExceptionResource resource - ) - { - return new ArgumentOutOfRangeException( - GetArgumentName(argument) + "[" + paramNumber + "]", - GetResourceString(resource) - ); - } - - private static InvalidOperationException GetInvalidOperationException_EnumCurrent(int index) - { - return new InvalidOperationException( - (index < 0) ? SR.InvalidOperation_EnumNotStarted : SR.InvalidOperation_EnumEnded - ); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static void IfNullAndNullsAreIllegalThenThrow( - object value, - ExceptionArgument argName - ) - { - if (default(T) != null && value == null) - { - ThrowArgumentNullException(argName); - } - } - - private static string GetArgumentName(ExceptionArgument argument) - { - return argument switch - { - ExceptionArgument.obj => "obj", - ExceptionArgument.dictionary => "dictionary", - ExceptionArgument.array => "array", - ExceptionArgument.info => "info", - ExceptionArgument.key => "key", - ExceptionArgument.text => "text", - ExceptionArgument.values => "values", - ExceptionArgument.value => "value", - ExceptionArgument.startIndex => "startIndex", - ExceptionArgument.task => "task", - ExceptionArgument.bytes => "bytes", - ExceptionArgument.byteIndex => "byteIndex", - ExceptionArgument.byteCount => "byteCount", - ExceptionArgument.ch => "ch", - ExceptionArgument.chars => "chars", - ExceptionArgument.charIndex => "charIndex", - ExceptionArgument.charCount => "charCount", - ExceptionArgument.s => "s", - ExceptionArgument.input => "input", - ExceptionArgument.ownedMemory => "ownedMemory", - ExceptionArgument.list => "list", - ExceptionArgument.index => "index", - ExceptionArgument.capacity => "capacity", - ExceptionArgument.collection => "collection", - ExceptionArgument.item => "item", - ExceptionArgument.converter => "converter", - ExceptionArgument.match => "match", - ExceptionArgument.count => "count", - ExceptionArgument.action => "action", - ExceptionArgument.comparison => "comparison", - ExceptionArgument.exceptions => "exceptions", - ExceptionArgument.exception => "exception", - ExceptionArgument.pointer => "pointer", - ExceptionArgument.start => "start", - ExceptionArgument.format => "format", - ExceptionArgument.formats => "formats", - ExceptionArgument.culture => "culture", - ExceptionArgument.comparer => "comparer", - ExceptionArgument.comparable => "comparable", - ExceptionArgument.source => "source", - ExceptionArgument.length => "length", - ExceptionArgument.comparisonType => "comparisonType", - ExceptionArgument.manager => "manager", - ExceptionArgument.sourceBytesToCopy => "sourceBytesToCopy", - ExceptionArgument.callBack => "callBack", - ExceptionArgument.creationOptions => "creationOptions", - ExceptionArgument.function => "function", - ExceptionArgument.scheduler => "scheduler", - ExceptionArgument.continuation => "continuation", - ExceptionArgument.continuationAction => "continuationAction", - ExceptionArgument.continuationFunction => "continuationFunction", - ExceptionArgument.tasks => "tasks", - ExceptionArgument.asyncResult => "asyncResult", - ExceptionArgument.beginMethod => "beginMethod", - ExceptionArgument.endMethod => "endMethod", - ExceptionArgument.endFunction => "endFunction", - ExceptionArgument.cancellationToken => "cancellationToken", - ExceptionArgument.continuationOptions => "continuationOptions", - ExceptionArgument.delay => "delay", - ExceptionArgument.millisecondsDelay => "millisecondsDelay", - ExceptionArgument.millisecondsTimeout => "millisecondsTimeout", - ExceptionArgument.stateMachine => "stateMachine", - ExceptionArgument.timeout => "timeout", - ExceptionArgument.type => "type", - ExceptionArgument.sourceIndex => "sourceIndex", - ExceptionArgument.sourceArray => "sourceArray", - ExceptionArgument.destinationIndex => "destinationIndex", - ExceptionArgument.destinationArray => "destinationArray", - ExceptionArgument.pHandle => "pHandle", - ExceptionArgument.handle => "handle", - ExceptionArgument.other => "other", - ExceptionArgument.newSize => "newSize", - ExceptionArgument.lowerBounds => "lowerBounds", - ExceptionArgument.lengths => "lengths", - ExceptionArgument.len => "len", - ExceptionArgument.keys => "keys", - ExceptionArgument.indices => "indices", - ExceptionArgument.index1 => "index1", - ExceptionArgument.index2 => "index2", - ExceptionArgument.index3 => "index3", - ExceptionArgument.length1 => "length1", - ExceptionArgument.length2 => "length2", - ExceptionArgument.length3 => "length3", - ExceptionArgument.endIndex => "endIndex", - ExceptionArgument.elementType => "elementType", - ExceptionArgument.arrayIndex => "arrayIndex", - ExceptionArgument.year => "year", - ExceptionArgument.codePoint => "codePoint", - ExceptionArgument.str => "str", - ExceptionArgument.options => "options", - ExceptionArgument.prefix => "prefix", - ExceptionArgument.suffix => "suffix", - ExceptionArgument.buffer => "buffer", - ExceptionArgument.buffers => "buffers", - ExceptionArgument.offset => "offset", - ExceptionArgument.stream => "stream", - ExceptionArgument.anyOf => "anyOf", - ExceptionArgument.overlapped => "overlapped", - ExceptionArgument.minimumBytes => "minimumBytes", - _ => "", - }; - } - - private static string GetResourceString(ExceptionResource resource) - { - return resource switch - { - ExceptionResource.ArgumentOutOfRange_IndexMustBeLessOrEqual - => SR.ArgumentOutOfRange_IndexMustBeLessOrEqual, - ExceptionResource.ArgumentOutOfRange_IndexMustBeLess - => SR.ArgumentOutOfRange_IndexMustBeLess, - ExceptionResource.ArgumentOutOfRange_IndexCount => SR.ArgumentOutOfRange_IndexCount, - ExceptionResource.ArgumentOutOfRange_IndexCountBuffer - => SR.ArgumentOutOfRange_IndexCountBuffer, - ExceptionResource.ArgumentOutOfRange_Count => SR.ArgumentOutOfRange_Count, - ExceptionResource.ArgumentOutOfRange_Year => SR.ArgumentOutOfRange_Year, - ExceptionResource.Arg_ArrayPlusOffTooSmall => SR.Arg_ArrayPlusOffTooSmall, - ExceptionResource.Arg_ByteArrayTooSmallForValue => SR.Arg_ByteArrayTooSmallForValue, - ExceptionResource.NotSupported_ReadOnlyCollection => SR.NotSupported_ReadOnlyCollection, - ExceptionResource.Arg_RankMultiDimNotSupported => SR.Arg_RankMultiDimNotSupported, - ExceptionResource.Arg_NonZeroLowerBound => SR.Arg_NonZeroLowerBound, - ExceptionResource.ArgumentOutOfRange_GetCharCountOverflow - => SR.ArgumentOutOfRange_GetCharCountOverflow, - ExceptionResource.ArgumentOutOfRange_ListInsert => SR.ArgumentOutOfRange_ListInsert, - ExceptionResource.ArgumentOutOfRange_NeedNonNegNum - => SR.ArgumentOutOfRange_NeedNonNegNum, - ExceptionResource.ArgumentOutOfRange_SmallCapacity - => SR.ArgumentOutOfRange_SmallCapacity, - ExceptionResource.Argument_InvalidOffLen => SR.Argument_InvalidOffLen, - ExceptionResource.Argument_CannotExtractScalar => SR.Argument_CannotExtractScalar, - ExceptionResource.ArgumentOutOfRange_BiggerThanCollection - => SR.ArgumentOutOfRange_BiggerThanCollection, - ExceptionResource.Serialization_MissingKeys => SR.Serialization_MissingKeys, - ExceptionResource.Serialization_NullKey => SR.Serialization_NullKey, - ExceptionResource.NotSupported_KeyCollectionSet => SR.NotSupported_KeyCollectionSet, - ExceptionResource.NotSupported_ValueCollectionSet => SR.NotSupported_ValueCollectionSet, - ExceptionResource.InvalidOperation_NullArray => SR.InvalidOperation_NullArray, - ExceptionResource.TaskT_TransitionToFinal_AlreadyCompleted - => SR.TaskT_TransitionToFinal_AlreadyCompleted, - ExceptionResource.TaskCompletionSourceT_TrySetException_NullException - => SR.TaskCompletionSourceT_TrySetException_NullException, - ExceptionResource.TaskCompletionSourceT_TrySetException_NoExceptions - => SR.TaskCompletionSourceT_TrySetException_NoExceptions, - ExceptionResource.NotSupported_StringComparison => SR.NotSupported_StringComparison, - ExceptionResource.ConcurrentCollection_SyncRoot_NotSupported - => SR.ConcurrentCollection_SyncRoot_NotSupported, - ExceptionResource.Task_MultiTaskContinuation_NullTask - => SR.Task_MultiTaskContinuation_NullTask, - ExceptionResource.InvalidOperation_WrongAsyncResultOrEndCalledMultiple - => SR.InvalidOperation_WrongAsyncResultOrEndCalledMultiple, - ExceptionResource.Task_MultiTaskContinuation_EmptyTaskList - => SR.Task_MultiTaskContinuation_EmptyTaskList, - ExceptionResource.Task_Start_TaskCompleted => SR.Task_Start_TaskCompleted, - ExceptionResource.Task_Start_Promise => SR.Task_Start_Promise, - ExceptionResource.Task_Start_ContinuationTask => SR.Task_Start_ContinuationTask, - ExceptionResource.Task_Start_AlreadyStarted => SR.Task_Start_AlreadyStarted, - ExceptionResource.Task_RunSynchronously_Continuation - => SR.Task_RunSynchronously_Continuation, - ExceptionResource.Task_RunSynchronously_Promise => SR.Task_RunSynchronously_Promise, - ExceptionResource.Task_RunSynchronously_TaskCompleted - => SR.Task_RunSynchronously_TaskCompleted, - ExceptionResource.Task_RunSynchronously_AlreadyStarted - => SR.Task_RunSynchronously_AlreadyStarted, - ExceptionResource.AsyncMethodBuilder_InstanceNotInitialized - => SR.AsyncMethodBuilder_InstanceNotInitialized, - ExceptionResource.Task_ContinueWith_ESandLR => SR.Task_ContinueWith_ESandLR, - ExceptionResource.Task_ContinueWith_NotOnAnything => SR.Task_ContinueWith_NotOnAnything, - ExceptionResource.Task_InvalidTimerTimeSpan => SR.Task_InvalidTimerTimeSpan, - ExceptionResource.Task_Delay_InvalidMillisecondsDelay - => SR.Task_Delay_InvalidMillisecondsDelay, - ExceptionResource.Task_Dispose_NotCompleted => SR.Task_Dispose_NotCompleted, - ExceptionResource.Task_ThrowIfDisposed => SR.Task_ThrowIfDisposed, - ExceptionResource.Task_WaitMulti_NullTask => SR.Task_WaitMulti_NullTask, - ExceptionResource.ArgumentException_OtherNotArrayOfCorrectLength - => SR.ArgumentException_OtherNotArrayOfCorrectLength, - ExceptionResource.ArgumentNull_Array => SR.ArgumentNull_Array, - ExceptionResource.ArgumentNull_SafeHandle => SR.ArgumentNull_SafeHandle, - ExceptionResource.ArgumentOutOfRange_EndIndexStartIndex - => SR.ArgumentOutOfRange_EndIndexStartIndex, - ExceptionResource.ArgumentOutOfRange_Enum => SR.ArgumentOutOfRange_Enum, - ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported - => SR.ArgumentOutOfRange_HugeArrayNotSupported, - ExceptionResource.Argument_AddingDuplicate => SR.Argument_AddingDuplicate, - ExceptionResource.Argument_InvalidArgumentForComparison - => SR.Argument_InvalidArgumentForComparison, - ExceptionResource.Arg_LowerBoundsMustMatch => SR.Arg_LowerBoundsMustMatch, - ExceptionResource.Arg_MustBeType => SR.Arg_MustBeType, - ExceptionResource.Arg_Need1DArray => SR.Arg_Need1DArray, - ExceptionResource.Arg_Need2DArray => SR.Arg_Need2DArray, - ExceptionResource.Arg_Need3DArray => SR.Arg_Need3DArray, - ExceptionResource.Arg_NeedAtLeast1Rank => SR.Arg_NeedAtLeast1Rank, - ExceptionResource.Arg_RankIndices => SR.Arg_RankIndices, - ExceptionResource.Arg_RanksAndBounds => SR.Arg_RanksAndBounds, - ExceptionResource.InvalidOperation_IComparerFailed - => SR.InvalidOperation_IComparerFailed, - ExceptionResource.NotSupported_FixedSizeCollection - => SR.NotSupported_FixedSizeCollection, - ExceptionResource.Rank_MultiDimNotSupported => SR.Rank_MultiDimNotSupported, - ExceptionResource.Arg_TypeNotSupported => SR.Arg_TypeNotSupported, - ExceptionResource.Argument_SpansMustHaveSameLength - => SR.Argument_SpansMustHaveSameLength, - ExceptionResource.Argument_InvalidFlag => SR.Argument_InvalidFlag, - ExceptionResource.CancellationTokenSource_Disposed - => SR.CancellationTokenSource_Disposed, - ExceptionResource.Argument_AlignmentMustBePow2 => SR.Argument_AlignmentMustBePow2, - ExceptionResource.ArgumentOutOfRange_NotGreaterThanBufferLength - => SR.ArgumentOutOfRange_NotGreaterThanBufferLength, - ExceptionResource.InvalidOperation_SpanOverlappedOperation - => SR.InvalidOperation_SpanOverlappedOperation, - ExceptionResource.InvalidOperation_TimeProviderNullLocalTimeZone - => SR.InvalidOperation_TimeProviderNullLocalTimeZone, - ExceptionResource.InvalidOperation_TimeProviderInvalidTimestampFrequency - => SR.InvalidOperation_TimeProviderInvalidTimestampFrequency, - ExceptionResource.Format_UnexpectedClosingBrace => SR.Format_UnexpectedClosingBrace, - ExceptionResource.Format_UnclosedFormatItem => SR.Format_UnclosedFormatItem, - ExceptionResource.Format_ExpectedAsciiDigit => SR.Format_ExpectedAsciiDigit, - _ => "", - }; - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/TimeOnly.cs b/src/PRE_NET6_0_POLYFILLS/TimeOnly.cs deleted file mode 100644 index 3325dd2..0000000 --- a/src/PRE_NET6_0_POLYFILLS/TimeOnly.cs +++ /dev/null @@ -1,244 +0,0 @@ -#if !NET6_0_OR_GREATER -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Numerics; -using System.Globalization; -using System.ComponentModel; -using TimeOnlyTuple = (long ticks, int hour, int minute, int second, int milli, int micro); - -namespace System -{ - /// - /// Represents a time of day, as would be read from a clock, within the range 00:00:00 to 23:59:59.9999999. - /// - public readonly partial struct TimeOnly - : IComparable, - IComparable, - IEquatable //, - //ISpanFormattable, - //ISpanParsable, - //IUtf8SpanFormattable - { - private long _ticks => GetTicks(Hour, Minute, Second, Microsecond); - private const long TicksPerMillisecond = 10_000L; - private const long TicksPerSecond = 100_000_000L; - private const long TicksPerMinute = 60_000_000_000L; - private const long TicksPerHour = 360_000_000_000L; - internal const int MillisPerSecond = 1_000; - internal const int MillisPerMinute = 60 * MillisPerSecond; - internal const int MillisPerHour = 60 * MillisPerMinute; - - private static TimeOnlyTuple GetParts(long tickCount) - { - var parts = Math.DivRem(tickCount, TicksPerHour, out var hourTicks); - var hoursResult = ( - Value: SpanHelper.DigitsToInt64((int)(hourTicks / TicksPerMinute), 2), - Foo: "Bar" - ); - parts = Math.DivRem(parts, TicksPerMinute, out var minuteTicks); - var minutesResult = ( - Value: SpanHelper.DigitsToInt64((int)(minuteTicks / TicksPerSecond), 2), - Foo: "Bar" - ); - parts = Math.DivRem(parts, TicksPerSecond, out var secondTicks); - var secondsResult = ( - Value: SpanHelper.DigitsToInt64((int)(secondTicks / TicksPerMillisecond), 2), - Foo: "Bar" - ); - var millisecondsResult = ( - Value: (int)Math.DivRem(parts, TicksPerMillisecond, out var microsecondTicks), - Foo: "Bar" - ); - var microsecondsResult = ( - Value: SpanHelper.DigitsToInt64((int)microsecondTicks, 6), - Foo: "Bar" - ); - - return ( - tickCount, - (int)hoursResult.Value, - (int)minutesResult.Value, - (int)secondsResult.Value, - (int)millisecondsResult.Value, - (int)microsecondsResult.Value - ); - } - - // This is to avoid overflow in the calculation above. - private static long GetTicks( - int hour, - int minute, - int second, - int millisecond, - int microsecond - ) - { - long totalHours = checked((long)hour * 3600L); - long totalMinutes = checked((long)minute * 60L); - long totalSeconds = checked((long)second); - long totalMilliseconds = checked((long)millisecond * TicksPerMillisecond); - long totalMicroseconds = checked(microsecond); - - long result = - ((totalHours + totalMinutes + totalSeconds) * TicksPerSecond) - + totalMilliseconds - + totalMicroseconds; - return result; - } - - private static long GetTicks(int hour, int minute, int second, int microsecond) - { - long totalHours = checked((long)hour * TicksPerHour); - long totalMinutes = checked((long)minute * TicksPerMinute); - long totalSeconds = checked((long)second * TicksPerSecond); - long totalMicroseconds = checked(microsecond * TicksPerMillisecond); - - long result = totalHours + totalMinutes + totalSeconds + totalMicroseconds; - return result; - } - - /// - /// Initializes a new instance of the TimeOnly structure to the specified hour, minute, and second. - /// - /// The hours (0 through 23). - /// The minutes (0 through 59). - /// The seconds (0 through 59). - public TimeOnly(int hour, int minute, int second) - { - TimeOnlyTuple validation = ValidateInputs(hour, minute, second, 0, 0); - - Hour = validation.hour; - Minute = validation.minute; - Second = validation.second; - Millisecond = validation.milli; - Microsecond = validation.micro; - } - - /// - /// Initializes a new instance of the TimeOnly structure to the specified hour, minute, second and millisecond. - /// - /// The hours (0 through 23). - /// The minutes (0 through 59). - /// The seconds (0 through 59). - /// The milliseconds (0 through 999). - public TimeOnly(int hour, int minute, int second, int millisecond) - { - TimeOnlyTuple validation = ValidateInputs(hour, minute, second, millisecond, 0); - - Hour = validation.hour; - Minute = validation.minute; - Second = validation.second; - Millisecond = validation.milli; - Microsecond = validation.micro; - } - - /// - /// Initializes a new instance of the TimeOnly structure to the specified hour, minute, second, millisecond and microsecond. - /// - /// The hours (0 through 23). - /// The minutes (0 through 59). - /// The seconds (0 through 59). - /// The milliseconds (0 through 999). - /// The microseconds (0 through 999). - public TimeOnly(int hour, int minute, int second, int millisecond, int microsecond) - { - TimeOnlyTuple validation = ValidateInputs( - hour, - minute, - second, - millisecond, - microsecond - ); - - Hour = validation.hour; - Minute = validation.minute; - Second = validation.second; - Millisecond = validation.milli; - Microsecond = validation.micro; - } - - private static TimeOnlyTuple ValidateInputs( - int hours, - int minutes, - int seconds, - int milliseconds, - int microseconds = 0 - ) - { - if ((uint)hours > 24u) - ThrowHelper.ThrowArgumentOutOfRangeException(); - if ((uint)minutes >= 60u) - ThrowHelper.ThrowArgumentOutOfRangeException(); - if ((uint)seconds >= 60u) - ThrowHelper.ThrowArgumentOutOfRangeException(); - if ((uint)milliseconds >= 1000u) - ThrowHelper.ThrowArgumentOutOfRangeException(); - if ((uint)microseconds >= 1000u) - ThrowHelper.ThrowArgumentOutOfRangeException(); - - return ( - GetTicks(hours, minutes, seconds, milliseconds, microseconds), - hours, - minutes, - seconds, - milliseconds, - microseconds - ); - } - - /// - /// Initializes a new instance of the TimeOnly structure to the specified hour and minute, and zero seconds, milliseconds and microseconds. - /// - /// The hours (0 through 23). - /// The minutes (0 through 59). - public TimeOnly(int hour, int minute) - { - TimeOnlyTuple validation = ValidateInputs(hour, minute, 0, 0, 0); - - Hour = validation.hour; - Minute = validation.minute; - Second = validation.second; - Millisecond = validation.milli; - Microsecond = validation.micro; - } - - /// - /// Gets the hour component of the time represented by this instance. - /// - public int Hour { get; init; } - - /// - /// Gets the minute component of the time represented by this instance. - /// - public int Minute { get; init; } - - /// - /// Gets the second component of the time represented by this instance. - /// - public int Second { get; init; } - - /// - /// Gets the millisecond component of the time represented by this instance. - /// - public int Millisecond { get; init; } - - /// - /// Gets the microsecond component of the time represented by this instance. - /// - public int Microsecond { get; init; } - - /// - /// Gets the number of ticks that represent the time of this instance. - /// - public long Ticks => GetTicks(Hour, Minute, Second, Millisecond, Microsecond); - - /// - /// Gets the time of day for this instance. - /// - public TimeSpan TimeOfDay => new TimeSpan(Ticks); - } -} -#endif diff --git a/src/PRE_NET6_0_POLYFILLS/TimeOnly2.cs b/src/PRE_NET6_0_POLYFILLS/TimeOnly2.cs deleted file mode 100644 index 6907ed0..0000000 --- a/src/PRE_NET6_0_POLYFILLS/TimeOnly2.cs +++ /dev/null @@ -1,191 +0,0 @@ -#if !NET6_0_OR_GREATER -using System; -using System.Security; - -namespace System; - -public readonly partial struct TimeOnly : IComparable, IComparable, IEquatable //, ISpanFormattable//, IUtf8SpanFormattable -{ - // ... - - /// - /// Compares this to another object. - /// - /// The object to compare to. - /// - /// A 32-bit signed integer that indicates whether this is earlier than, the same as, or later than the other object: - /// Less than zero: This is earlier. - /// Zero: This is the same. - /// Greater than zero: This is later. - /// - /// Thrown when is not of type . - public int CompareTo(object obj) - { - if (obj is null) - { - return 1; - } - - if (obj is TimeOnly other) - { - return CompareTo(other); - } - - throw new ArgumentException("Object must be of type TimeOnly."); - } - - /// - /// Compares this to another object. - /// - /// The object to compare to. - /// - /// A 32-bit signed integer that indicates whether this is earlier than, the same as, or later than the other object: - /// Less than zero: This is earlier. - /// Zero: This is the same. - /// Greater than zero: This is later. - /// - public int CompareTo(TimeOnly other) - { - return Ticks.CompareTo(other.Ticks); - } - - /// - /// Determines whether this instance is equal to another object. - /// - /// The object to compare with this instance. - /// - /// true if the two objects are equal; otherwise, false. - /// - public bool Equals(TimeOnly other) - { - return Ticks == other.Ticks; - } - - public TimeOnly(long ticks) - : this(new TimeSpan(ticks)) { } - - public TimeOnly(TimeSpan timespan) - : this(timespan.Hours, timespan.Minutes, timespan.Seconds, timespan.Milliseconds) { } - - /// - /// Tries to format the current object into a span of characters. - /// - /// The span of characters where the formatted output will be written. - /// - /// When this method returns, contains the number of characters written into . - /// - /// A read-only span representing the format string. (Optional) - /// An optional provider for formatting information. (Optional) - /// - /// true if the formatting was successful and contains the formatted output; - /// otherwise, false. - /// - public bool TryFormat( - Span destination, - out int charsWritten, - ReadOnlySpan format = default, - IFormatProvider? formatProvider = null - ) - { - if (destination.Length < 8) - { - charsWritten = 0; - return false; - } - - var parts = GetParts(Ticks); - var hour = parts.hour.ToString("D2"); - var minute = parts.minute.ToString("D2"); - var second = parts.second.ToString("D2"); - - var length = 0; - for (var i = 0; i < hour.Length; i++) - { - destination[length++] = hour[i]; - } - - destination[length++] = ':'; - - for (var i = 0; i < minute.Length; i++) - { - destination[length++] = minute[i]; - } - - destination[length++] = ':'; - - for (var i = 0; i < second.Length; i++) - { - destination[length++] = second[i]; - } - - charsWritten = length; - return true; - } - - /// - /// Tries to format the current object into a span of UTF-8 bytes. - /// - /// The span of bytes where the formatted output will be written. - /// - /// When this method returns, contains the number of bytes written into . - /// - /// A read-only span representing the format string. (Optional) - /// An optional provider for formatting information. (Optional) - /// - /// true if the formatting was successful and contains the formatted output; - /// otherwise, false. - /// - public bool TryFormatUtf8( - Span destination, - out int bytesWritten, - ReadOnlySpan format = default, - IFormatProvider? formatProvider = null - ) - { - if (destination.Length < 8) - { - bytesWritten = 0; - return false; - } - - var parts = GetParts(Ticks); - var hour = parts.hour.ToString("D2"); - var minute = parts.minute.ToString("D2"); - var second = parts.second.ToString("D2"); - - var length = 0; - for (var i = 0; i < hour.Length; i++) - { - destination[length++] = (byte)hour[i]; - } - - destination[length++] = (byte)':'; - - for (var i = 0; i < minute.Length; i++) - { - destination[length++] = (byte)minute[i]; - } - - destination[length++] = (byte)':'; - - for (var i = 0; i < second.Length; i++) - { - destination[length++] = (byte)second[i]; - } - - bytesWritten = length; - return true; - } - - public string ToLongTimeString() => Format("HH:MM:ss.ffff"); - - public static implicit operator TimeOnly(TimeSpan time) => - new TimeOnly(time.Hours, time.Minutes, time.Seconds, time.Milliseconds); - - public static TimeOnly Parse(string s, string format = "HH:MM:ss.ffff") => - DateTime.ParseExact(s, format, null, Globalization.DateTimeStyles.None).TimeOfDay; - - public static TimeOnly Parse(string s, IFormatProvider provider) => - DateTime.Parse(s, provider).TimeOfDay; -} -#endif diff --git a/src/PhoneNumber.cs b/src/PhoneNumber.cs index a018ca3..4b44773 100644 --- a/src/PhoneNumber.cs +++ b/src/PhoneNumber.cs @@ -41,7 +41,7 @@ public partial record struct PhoneNumber : IRegexValueObject /// public const string UriPrefix = "tel:"; public const string UriPattern = $"{UriPrefix}{{0}}"; - public static string Description => "a phone number in e.164 format"; + public const string DescriptionString = "a phone number in e.164 format"; public const string ExampleString = "+19174097331"; public static PhoneNumber ExampleValue => From(ExampleString); public const string EmptyString = "+10000000000"; @@ -76,14 +76,15 @@ public static PhoneNumber FromUri(Uri u) => OriginalString = u.ToString() }; -#if NET6_0_OR_GREATER - static string IRegexValueObject.RegexString => RegexString; - static string IRegexValueObject.Description => Description; -#else - readonly string IRegexValueObject.RegexString => RegexString; - readonly string IRegexValueObject.Description => Description; - readonly PhoneNumber IRegexValueObject.ExampleValue => ExampleValue; -#endif + // #if NET6_0_OR_GREATER + // public static string RegexString => RegexString; + public static string Description => DescriptionString; + + // #else + // readonly string RegexString => RegexString; + // readonly string Description => Description; + // readonly PhoneNumber ExampleValue => ExampleValue; + // #endif public override readonly string ToString() => IsEmpty ? string.Empty : _util.Format(ParsedNumber, PhoneNumberFormat.E164); @@ -123,13 +124,13 @@ or InvalidOperationException #if NET7_0_OR_GREATER [GeneratedRegex(RegexString, RegexOptions)] public static partial Regex Regex(); -#elif NET6_0_OR_GREATER +#else// NET6_0_OR_GREATER public static Regex Regex() => new(RegexString, RegexOptions); - // Regex IRegexValueObject.RegexString => Regex(); -#else - private static readonly Regex _regex = new(RegexString, RegexOptions); + // Regex RegexString => Regex(); + // #else + // private static readonly Regex _regex = new(RegexString, RegexOptions); - readonly Regex IRegexValueObject.Regex() => _regex; + // readonly Regex Regex() => _regex; #endif public static implicit operator PhoneNumber?(string? s) => @@ -165,8 +166,7 @@ public static Validation Validate(string s) => : Validation.Invalid("Phone number is not valid."); #else public static Validation Validate(string s) => - Util.IsViablePhoneNumber(s) - && ((IRegexValueObject)ExampleValue).Regex().IsMatch(s) + Util.IsViablePhoneNumber(s) && Regex().IsMatch(s) ? Validation.Ok : Validation.Invalid("Phone number is not valid."); #endif @@ -179,8 +179,8 @@ public static PhoneNumber Parse(string s, IFormatProvider? formatProvider) => public static PhoneNumber Parse(string value) => From(value) with { OriginalString = value }; - public readonly int CompareTo(object? obj) => - obj is not PhoneNumber n ? -1 : CompareOrdinal(Value, n.Value); + // public readonly int CompareTo(object? obj) => + // obj is not PhoneNumber n ? -1 : CompareOrdinal(Value, n.Value); #if !NETSTANDARD2_0_OR_GREATER public string Value { get; private set; } diff --git a/src/Polyfill/IsExternalInit.cs b/src/Polyfill/IsExternalInit.cs new file mode 100644 index 0000000..9eb6e9f --- /dev/null +++ b/src/Polyfill/IsExternalInit.cs @@ -0,0 +1,14 @@ +// // Licensed to the .NET Foundation under one or more agreements. +// // The .NET Foundation licenses this file to you under the MIT license. + +// using System.ComponentModel; + +// namespace System.Runtime.CompilerServices +// { +// /// +// /// Reserved to be used by the compiler for tracking metadata. This class +// /// should not be used by developers in source code. +// /// +// [EditorBrowsable(EditorBrowsableState.Never)] +// internal static class IsExternalInit { } +// } diff --git a/src/iri.cs b/src/iri.cs index 9b1fd78..ff8f192 100644 --- a/src/iri.cs +++ b/src/iri.cs @@ -37,7 +37,7 @@ public readonly partial record struct iri IUriConvertible #endif { - public const string Description = "an internationalized resource identifier (iri)"; + public const string DescriptionString = "an internationalized resource identifier (iri)"; #if NET7_0_OR_GREATER [@StringSyntax(StringSyntaxAttribute.Uri)] @@ -68,18 +68,21 @@ public readonly partial record struct iri $"{Path}{(!IsNullOrEmpty(Query) ? $"?{Query})" : "")}{(!IsNullOrEmpty(Fragment) ? $"#{Fragment}" : "")}"; public readonly string Value => ToString(); -#if NET6_0_OR_GREATER - static string IRegexValueObject.RegexString => RegexString; - static string IRegexValueObject.Description => Description; - static iri IRegexValueObject.Empty => EmptyStringValue; - static iri IRegexValueObject.ExampleValue => new(ExampleStringValue); -#else - readonly string IRegexValueObject.Description => Description; - readonly iri IRegexValueObject.ExampleValue => ExampleStringValue; - readonly string IRegexValueObject.RegexString => RegexString; - - readonly Regex IRegexValueObject.Regex() => Regex(); -#endif + + // #if NET6_0_OR_GREATER + // public static string RegexString => _RegexString; + public static string Description => DescriptionString; + + // public static iri Empty => EmptyStringValue; + public static iri ExampleValue => new(ExampleStringValue); + + // #else + // readonly string Description => Description; + // readonly iri ExampleValue => ExampleStringValue; + // readonly string RegexString => RegexString; + + // readonly Regex Regex() => Regex(); + // #endif // public static iri Parse(string iri) => From(iri); diff --git a/src/uri.cs b/src/uri.cs index 721acd0..4fae61a 100644 --- a/src/uri.cs +++ b/src/uri.cs @@ -42,7 +42,7 @@ namespace System; IUriConvertible #endif { - public const string Description = "a uniform resource identifier (uri)"; + public const string DescriptionString = "a uniform resource identifier (uri)"; #if NET7_0_OR_GREATER [@StringSyntax(StringSyntaxAttribute.Uri)] @@ -74,20 +74,23 @@ namespace System; ); public readonly string Value => ToString(); -#if NET6_0_OR_GREATER - static string IRegexValueObject.RegexString => RegexString; - static string IRegexValueObject.Description => Description; - static uri IRegexValueObject.Empty => EmptyStringValue; - static uri IRegexValueObject.ExampleValue => new(ExampleStringValue); - - static uri IRegexValueObject.Parse(string s) => From(s) with { OriginalString = s }; -#else - readonly string IRegexValueObject.Description => Description; - readonly uri IRegexValueObject.ExampleValue => ExampleStringValue; - readonly string IRegexValueObject.RegexString => RegexString; - - readonly Regex IRegexValueObject.Regex() => Regex(); -#endif + + // #if NET6_0_OR_GREATER + // public static string RegexString => _RegexString; + public static string Description => DescriptionString; + + // public static uri Empty => EmptyStringValue; + public static uri ExampleValue => new(ExampleStringValue); + + // public static uri Parse(string s) => From(s) with { OriginalString = s }; + + // #else + // readonly string Description => Description; + // readonly uri ExampleValue => ExampleStringValue; + // readonly string RegexString => RegexString; + + // readonly Regex Regex() => Regex(); + // #endif public readonly Uri Uri => this; @@ -192,7 +195,8 @@ or ArgumentException or InvalidCastException or InvalidOperationException ) - { /* ignore it */ + { + /* ignore it */ } uri = Empty; diff --git a/src/url.cs b/src/url.cs index 549a6dd..5130839 100644 --- a/src/url.cs +++ b/src/url.cs @@ -31,14 +31,14 @@ namespace System; [StructLayout(LayoutKind.Auto)] [DebuggerDisplay("{ToString()}")] public readonly partial record struct url - : IRegexValueObject, - IResourceIdentifierWithQueryAndFragment + : //IRegexValueObject, + IResourceIdentifierWithQueryAndFragment #if NET7_0_OR_GREATER , IUriConvertible #endif { - public const string Description = "a uniform resource locator (URL)"; + public const string DescriptionString = "a uniform resource locator (URL)"; #if NET7_0_OR_GREATER [@StringSyntax(StringSyntaxAttribute.Uri)] @@ -65,17 +65,20 @@ public readonly partial record struct url $"{Path}{(!IsNullOrEmpty(Query) ? $"?{Query})" : "")}{(!IsNullOrEmpty(Fragment) ? $"#{Fragment}" : "")}"; public readonly string Value => ToString(); -#if NET6_0_OR_GREATER - static string IRegexValueObject.Description => Description; - static string IRegexValueObject.RegexString => RegexString; - static url IRegexValueObject.ExampleValue => ExampleStringValue; -#else - readonly string IRegexValueObject.Description => Description; - readonly url IRegexValueObject.ExampleValue => ExampleStringValue; - readonly string IRegexValueObject.RegexString => RegexString; - - readonly Regex IRegexValueObject.Regex() => Regex(); -#endif + + // #if NET6_0_OR_GREATER + public static string Description => DescriptionString; + + // public static string RegexString => _RegexString; + public static url ExampleValue => ExampleStringValue; + + // #else + // readonly string IRegexValueObject.Description => Description; + // readonly url IRegexValueObject.ExampleValue => ExampleStringValue; + // readonly string IRegexValueObject.RegexString => RegexString; + + // readonly Regex IRegexValueObject.Regex() => Regex(); + // #endif public readonly Uri Uri => this; diff --git a/src/urn.cs b/src/urn.cs index b2a0f56..b5a7971 100644 --- a/src/urn.cs +++ b/src/urn.cs @@ -33,7 +33,7 @@ namespace System; #endif { public readonly string? DoubleSlashes { get; } = null; - public const string Description = "a uniform resource name (urn)"; + public const string DescriptionString = "a uniform resource name (urn)"; #if NET7_0_OR_GREATER [@StringSyntax(StringSyntaxAttribute.Uri)] @@ -59,20 +59,24 @@ namespace System; public readonly bool IsEmpty => BaseToString() == EmptyStringValue; public readonly string PathAndQuery => $"{Namespace}:{NamespaceSpecificString}"; public readonly string Value => ToString(); -#if NET6_0_OR_GREATER - static string IRegexValueObject.Description => Description; - static string IRegexValueObject.RegexString => RegexString; - static urn IRegexValueObject.Empty => EmptyStringValue; - static urn IRegexValueObject.ExampleValue => new(ExampleStringValue); -#else - readonly string IRegexValueObject.Description => Description; - readonly urn IRegexValueObject.ExampleValue => ExampleStringValue; - - // urn IRegexValueObject.Empty => EmptyValue; - readonly string IRegexValueObject.RegexString => RegexString; - - readonly Regex IRegexValueObject.Regex() => Regex(); -#endif + + // #if NET6_0_OR_GREATER + public static string Description => DescriptionString; + + // public static string RegexString => _RegexString; + + // public static urn Empty => EmptyStringValue; + public static urn ExampleValue => new(ExampleStringValue); + + // #else + // readonly string IRegexValueObject.Description => Description; + // readonly urn IRegexValueObject.ExampleValue => ExampleStringValue; + + // // urn IRegexValueObject.Empty => EmptyValue; + // readonly string IRegexValueObject.RegexString => RegexString; + + // readonly Regex IRegexValueObject.Regex() => Regex(); + // #endif // public static urn Parse(string urn) => From(urn); diff --git a/src/xri.cs b/src/xri.cs index 9ed5bea..f582d60 100644 --- a/src/xri.cs +++ b/src/xri.cs @@ -34,7 +34,7 @@ public readonly partial record struct xri IUriConvertible #endif { - public const string Description = "an eXtensible resource locator (xri)"; + public const string DescriptionString = "an eXtensible resource locator (xri)"; #if NET7_0_OR_GREATER [@StringSyntax(StringSyntaxAttribute.Uri)] @@ -64,17 +64,20 @@ public readonly partial record struct xri $"{Path}{(Path.EndsWith("/") ? "" : "/")}{(!IsNullOrEmpty(Query) ? $" ?{Query})" : "")}{(!IsNullOrEmpty(Fragment) ? $"#{Fragment}" : "")}"; public readonly string Value { get; init; } -#if NET6_0_OR_GREATER - static string IRegexValueObject.Description => Description; - static string IRegexValueObject.RegexString => RegexString; - static xri IRegexValueObject.ExampleValue => ExampleStringValue; -#else - readonly string IRegexValueObject.Description => Description; - readonly xri IRegexValueObject.ExampleValue => ExampleStringValue; - readonly string IRegexValueObject.RegexString => RegexString; - - readonly Regex IRegexValueObject.Regex() => Regex(); -#endif + + // #if NET6_0_OR_GREATER + public static string Description => DescriptionString; + + // public static string RegexString => _RegexString; + public static xri ExampleValue => ExampleStringValue; + + // #else + // readonly string IRegexValueObject.Description => Description; + // readonly xri IRegexValueObject.ExampleValue => ExampleStringValue; + // readonly string IRegexValueObject.RegexString => RegexString; + + // readonly Regex IRegexValueObject.Regex() => Regex(); + // #endif public readonly Uri Uri => this;