[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "AssemblyNative_GetEntryAssembly")]
private static partial void GetEntryAssemblyNative(ObjectHandleOnStack retAssembly);
- private static Assembly? GetEntryAssemblyInternal()
+ private static RuntimeAssembly? GetEntryAssemblyInternal()
{
RuntimeAssembly? entryAssembly = null;
GetEntryAssemblyNative(ObjectHandleOnStack.Create(ref entryAssembly));
throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
}
- private int GetMemberRefToken(MethodBase methodInfo, Type[]? optionalParameterTypes)
+ private int GetMemberRefToken(MethodInfo methodInfo, Type[]? optionalParameterTypes)
{
Type[]? parameterTypes;
Type[][]? requiredCustomModifiers;
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
return pcas.Count > 0 ? GetCombinedList(cad, ref pcas) : cad;
}
- private static IList<CustomAttributeData> GetCombinedList(IList<CustomAttributeData> customAttributes, ref RuntimeType.ListBuilder<Attribute> pseudoAttributes)
+ private static ReadOnlyCollection<CustomAttributeData> GetCombinedList(IList<CustomAttributeData> customAttributes, ref RuntimeType.ListBuilder<Attribute> pseudoAttributes)
{
Debug.Assert(pseudoAttributes.Count != 0);
internal static partial bool TraceSatelliteSubdirectoryPathProbed(string filePath, int hResult);
[RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
- private Assembly InternalLoadFromPath(string? assemblyPath, string? nativeImagePath)
+ private RuntimeAssembly InternalLoadFromPath(string? assemblyPath, string? nativeImagePath)
{
RuntimeAssembly? loadedAssembly = null;
LoadFromPath(_nativeAssemblyLoadContext, assemblyPath, nativeImagePath, ObjectHandleOnStack.Create(ref loadedAssembly));
}
// Called internally
- private static PropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
+ private static RuntimePropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
{
RuntimePropertyInfo property;
RuntimePropertyInfo[] candidates =
throw CreateGetMemberWithSameMetadataDefinitionAsNotFoundException(member);
}
- private static MemberInfo? GetMethodWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo method)
+ private static RuntimeMethodInfo? GetMethodWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo method)
{
RuntimeMethodInfo[] cache = runtimeType.Cache.GetMethodList(MemberListType.CaseSensitive, method.Name);
return null;
}
- private static MemberInfo? GetConstructorWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo constructor)
+ private static RuntimeConstructorInfo? GetConstructorWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo constructor)
{
RuntimeConstructorInfo[] cache = runtimeType.Cache.GetConstructorList(MemberListType.CaseSensitive, constructor.Name);
return null;
}
- private static MemberInfo? GetPropertyWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo property)
+ private static RuntimePropertyInfo? GetPropertyWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo property)
{
RuntimePropertyInfo[] cache = runtimeType.Cache.GetPropertyList(MemberListType.CaseSensitive, property.Name);
return null;
}
- private static MemberInfo? GetFieldWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo field)
+ private static RuntimeFieldInfo? GetFieldWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo field)
{
RuntimeFieldInfo[] cache = runtimeType.Cache.GetFieldList(MemberListType.CaseSensitive, field.Name);
return null;
}
- private static MemberInfo? GetEventWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo eventInfo)
+ private static RuntimeEventInfo? GetEventWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo eventInfo)
{
RuntimeEventInfo[] cache = runtimeType.Cache.GetEventList(MemberListType.CaseSensitive, eventInfo.Name);
return null;
}
- private static MemberInfo? GetNestedTypeWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo nestedType)
+ private static RuntimeType? GetNestedTypeWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo nestedType)
{
RuntimeType[] cache = runtimeType.Cache.GetNestedTypeList(MemberListType.CaseSensitive, nestedType.Name);
using System.Text;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using System.Security.Cryptography;
using Internal.Cryptography;
+using Microsoft.Win32.SafeHandles;
+
using static Interop;
using static Interop.BCrypt;
-using Microsoft.Win32.SafeHandles;
namespace Internal.NativeCrypto
{
}
}
- private static Exception CreateCryptographicException(NTSTATUS ntStatus)
+ private static CryptographicException CreateCryptographicException(NTSTATUS ntStatus)
{
int hr = ((int)ntStatus) | 0x01000000;
return hr.ToCryptographicException();
return _key.Value.DuplicateHandle();
}
- private static Exception PaddingModeNotSupported() =>
+ private static CryptographicException PaddingModeNotSupported() =>
new CryptographicException(SR.Cryptography_InvalidPaddingMode);
}
}
static partial void ThrowIfNotSupported();
- private static Exception PaddingModeNotSupported() =>
+ private static CryptographicException PaddingModeNotSupported() =>
new CryptographicException(SR.Cryptography_InvalidPaddingMode);
}
}
elementType = type.GetGenericArguments()[0];
}
- IList list = new List<object?>();
+ var list = new List<object?>();
if (source != null)
{
}
Array result = Array.CreateInstance(elementType, list.Count);
- list.CopyTo(result, 0);
+ ((IList)list).CopyTo(result, 0);
return result;
}
return propertyBindingPoint.Value;
}
- private static string GetPropertyName(MemberInfo property)
+ private static string GetPropertyName(PropertyInfo property)
{
ThrowHelper.ThrowIfNull(property);
public static IDictionary<string, string?> Parse(Stream input)
=> new JsonConfigurationFileParser().ParseStream(input);
- private IDictionary<string, string?> ParseStream(Stream input)
+ private Dictionary<string, string?> ParseStream(Stream input)
{
var jsonDocumentOptions = new JsonDocumentOptions
{
return name;
}
- private static IDictionary<string, string?> ProvideConfiguration(XmlConfigurationElement? root)
+ private static Dictionary<string, string?> ProvideConfiguration(XmlConfigurationElement? root)
{
Dictionary<string, string?> configuration = new(StringComparer.OrdinalIgnoreCase);
public class ConfigurationRoot : IConfigurationRoot, IDisposable
{
private readonly IList<IConfigurationProvider> _providers;
- private readonly IList<IDisposable> _changeTokenRegistrations;
+ private readonly List<IDisposable> _changeTokenRegistrations;
private ConfigurationReloadToken _changeToken = new ConfigurationReloadToken();
/// <summary>
return service;
}
- private static Expression BuildFactoryExpression(
+ private static NewExpression BuildFactoryExpression(
ConstructorInfo constructor,
int?[] parameterMap,
Expression serviceProvider,
return null;
}
- private ServiceCallSite CreateConstructorCallSite(
+ private ConstructorCallSite CreateConstructorCallSite(
ResultCache lifetime,
Type serviceType,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
}
// Move off the main stack
- private Expression BuildScopedExpression(ServiceCallSite callSite)
+ private ConditionalExpression BuildScopedExpression(ServiceCallSite callSite)
{
ConstantExpression callSiteExpression = Expression.Constant(
callSite,
return ResolveReferencePaths(DefaultResolver, assemblies);
}
- private IEnumerable<string> ResolveReferencePaths(ICompilationAssemblyResolver resolver, List<string> assemblies)
+ private List<string> ResolveReferencePaths(ICompilationAssemblyResolver resolver, List<string> assemblies)
{
if (!resolver.TryResolveAssemblyPaths(this, assemblies))
{
private const int UnseekableStreamInitialRentSize = 4096;
private static ReadOnlySpan<byte> Utf8Bom => new byte[] { 0xEF, 0xBB, 0xBF };
- private readonly IDictionary<string, string> _stringPool = new Dictionary<string, string>();
+ private readonly Dictionary<string, string> _stringPool = new Dictionary<string, string>();
public DependencyContext Read(Stream stream)
{
};
}
- private IEnumerable<Dependency> ReadTargetLibraryDependencies(ref Utf8JsonReader reader)
+ private List<Dependency> ReadTargetLibraryDependencies(ref Utf8JsonReader reader)
{
var dependencies = new List<Dependency>();
return reader.GetBoolean();
}
- private static Exception CreateUnexpectedException(ref Utf8JsonReader reader, string expected)
+ private static FormatException CreateUnexpectedException(ref Utf8JsonReader reader, string expected)
{
// Replace with public API once https://github.com/dotnet/runtime/issues/28482 is fixed
object boxedState = reader.CurrentState;
var allSegments = new List<IPathSegment>();
bool isParentSegmentLegal = true;
- IList<IPathSegment>? segmentsPatternStartsWith = null;
- IList<IList<IPathSegment>>? segmentsPatternContains = null;
- IList<IPathSegment>? segmentsPatternEndsWith = null;
+ List<IPathSegment>? segmentsPatternStartsWith = null;
+ List<IList<IPathSegment>>? segmentsPatternContains = null;
+ List<IPathSegment>? segmentsPatternEndsWith = null;
int endPattern = pattern.Length;
for (int scanPattern = 0; scanPattern < endPattern;)
/// </remarks>
public class Matcher
{
- private readonly IList<IPattern> _includePatterns = new List<IPattern>();
- private readonly IList<IPattern> _excludePatterns = new List<IPattern>();
+ private readonly List<IPattern> _includePatterns = new List<IPattern>();
+ private readonly List<IPattern> _excludePatterns = new List<IPattern>();
private readonly PatternBuilder _builder;
private readonly StringComparison _comparison;
// Trigger IHostApplicationLifetime.ApplicationStopping
_applicationLifetime.StopApplication();
- IList<Exception> exceptions = new List<Exception>();
+ var exceptions = new List<Exception>();
if (_hostedServices != null) // Started?
{
foreach (IHostedService hostedService in _hostedServices.Reverse())
set => _eventLog = value;
}
- private IEventLog CreateDefaultEventLog()
+ private WindowsEventLog CreateDefaultEventLog()
{
string logName = string.IsNullOrEmpty(LogName) ? "Application" : LogName;
string machineName = string.IsNullOrEmpty(MachineName) ? "." : MachineName;
return RuntimeGraph.Merge(existingGraph, runtimeGraph);
}
- private void ValidateImports(RuntimeGraph runtimeGraph, IDictionary<string, string> externalRIDs)
+ private void ValidateImports(RuntimeGraph runtimeGraph, Dictionary<string, string> externalRIDs)
{
foreach (var runtimeDescription in runtimeGraph.Runtimes.Values)
{
}
}
- private static IDictionary<string, IEnumerable<string>> GetCompatibilityMap(RuntimeGraph graph)
+ private static Dictionary<string, IEnumerable<string>> GetCompatibilityMap(RuntimeGraph graph)
{
Dictionary<string, IEnumerable<string>> compatibilityMap = new Dictionary<string, IEnumerable<string>>();
}
}
- private static void WriteCompatibilityMap(IDictionary<string, IEnumerable<string>> compatibilityMap, string mapFile)
+ private static void WriteCompatibilityMap(Dictionary<string, IEnumerable<string>> compatibilityMap, string mapFile)
{
var serializer = new JsonSerializer()
{
If declaringType.IsConstructedGenericType Then
declaringType = declaringType.GetGenericTypeDefinition
End If
- Dim rawMethod As MethodBase = Nothing
+ Dim rawMethod As MethodInfo = Nothing
For Each candidate As MethodInfo In declaringType.GetTypeInfo.GetDeclaredMethods(item.Name)
If candidate.HasSameMetadataDefinitionAs(item) Then
rawMethod = candidate
IEnumerator<KeyValuePair<long, TSource>>[] partitions
= new IEnumerator<KeyValuePair<long, TSource>>[partitionCount];
- IEnumerable<KeyValuePair<long, TSource>> partitionEnumerable = new InternalPartitionEnumerable(_source.GetEnumerator(), _useSingleChunking, true);
+ var partitionEnumerable = new InternalPartitionEnumerable(_source.GetEnumerator(), _useSingleChunking, true);
for (int i = 0; i < partitionCount; i++)
{
partitions[i] = partitionEnumerable.GetEnumerator();
public class StringEnumerator
{
private readonly System.Collections.IEnumerator _baseEnumerator;
- private readonly System.Collections.IEnumerable _temp;
internal StringEnumerator(StringCollection mappings)
{
- _temp = (IEnumerable)(mappings);
- _baseEnumerator = _temp.GetEnumerator();
+ _baseEnumerator = ((IEnumerable)mappings).GetEnumerator();
}
public string? Current
/// <returns>
/// Dictionary of control parameters.
/// </returns>
- private IDictionary<string, object?> BuildControlParametersDictionary()
+ private Dictionary<string, object?> BuildControlParametersDictionary()
{
- IDictionary<string, object?> controlParameters = new Dictionary<string, object?>();
+ var controlParameters = new Dictionary<string, object?>();
object?[]? inputControlParameters = _inputControlParameters;
Debug.Assert(instance != null);
// Step 1: Validate the object properties' validation attributes
- var errors = new List<ValidationError>();
- errors.AddRange(GetObjectPropertyValidationErrors(instance, validationContext, validateAllProperties,
- breakOnFirstError));
+ List<ValidationError> errors = GetObjectPropertyValidationErrors(instance, validationContext, validateAllProperties, breakOnFirstError);
// We only proceed to Step 2 if there are no errors
if (errors.Count > 0)
/// <param name="breakOnFirstError">Whether to break on the first error or validate everything.</param>
/// <returns>A list of <see cref="ValidationError" /> instances.</returns>
[RequiresUnreferencedCode(ValidationContext.InstanceTypeNotStaticallyDiscovered)]
- private static IEnumerable<ValidationError> GetObjectPropertyValidationErrors(object instance,
+ private static List<ValidationError> GetObjectPropertyValidationErrors(object instance,
ValidationContext validationContext, bool validateAllProperties, bool breakOnFirstError)
{
var properties = GetPropertyValues(instance, validationContext);
/// </returns>
/// <remarks>Ignores indexed properties.</remarks>
[RequiresUnreferencedCode(ValidationContext.InstanceTypeNotStaticallyDiscovered)]
- private static ICollection<KeyValuePair<ValidationContext, object?>> GetPropertyValues(object instance,
+ private static List<KeyValuePair<ValidationContext, object?>> GetPropertyValues(object instance,
ValidationContext validationContext)
{
var properties = TypeDescriptor.GetProperties(instance.GetType());
return partBuilder;
}
- private IEnumerable<Tuple<object, List<Attribute>>> EvaluateThisTypeAgainstTheConvention(Type type)
+ private List<Tuple<object, List<Attribute>>> EvaluateThisTypeAgainstTheConvention(Type type)
{
List<Attribute> attributes = new List<Attribute>();
private readonly ICompositionElement? _origin;
private PartCreationPolicyAttribute? _partCreationPolicy;
private ConstructorInfo? _constructor;
- private IEnumerable<ExportDefinition>? _exports;
- private IEnumerable<ImportDefinition>? _imports;
+ private List<ExportDefinition>? _exports;
+ private List<ImportDefinition>? _imports;
private HashSet<string>? _contractNamesOnNonInterfaces;
public AttributedPartCreationInfo(Type type, PartCreationPolicyAttribute? partCreationPolicy, bool ignoreConstructorImports, ICompositionElement? origin)
_imports = GetImportDefinitions();
}
- private IEnumerable<ExportDefinition> GetExportDefinitions()
+ private List<ExportDefinition> GetExportDefinitions()
{
List<ExportDefinition> exports = new List<ExportDefinition>();
return attributedProvider.IsAttributeDefined<InheritedExportAttribute>(false);
}
- private IEnumerable<ImportDefinition> GetImportDefinitions()
+ private List<ImportDefinition> GetImportDefinitions()
{
List<ImportDefinition> imports = new List<ImportDefinition>();
string typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(T));
- IDictionary<string, object?> metadata = new Dictionary<string, object?>();
+ var metadata = new Dictionary<string, object?>();
metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
return batch.AddExport(new Export(contractName, metadata, () => exportedValue));
return constraint;
}
- private static Expression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
+ private static BinaryExpression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
{
ArgumentNullException.ThrowIfNull(parameter);
return body;
}
- private static Expression CreateCreationPolicyConstraint(CreationPolicy policy, ParameterExpression parameter)
+ private static BinaryExpression CreateCreationPolicyConstraint(CreationPolicy policy, ParameterExpression parameter)
{
ArgumentNullException.ThrowIfNull(parameter);
CreateMetadataValueEqualsExpression(parameter, policy, CompositionConstants.PartCreationPolicyMetadataName));
}
- private static Expression CreateTypeIdentityConstraint(string requiredTypeIdentity, ParameterExpression parameter)
+ private static BinaryExpression CreateTypeIdentityConstraint(string requiredTypeIdentity, ParameterExpression parameter)
{
ArgumentNullException.ThrowIfNull(requiredTypeIdentity);
ArgumentNullException.ThrowIfNull(parameter);
CreateMetadataValueEqualsExpression(parameter, requiredTypeIdentity, CompositionConstants.ExportTypeIdentityMetadataName));
}
- private static Expression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
+ private static MethodCallExpression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
{
if (parameter == null)
{
Expression.Constant(constantKey));
}
- private static Expression CreateMetadataOfTypeExpression(ParameterExpression parameter, string constantKey, Type constantType)
+ private static MethodCallExpression CreateMetadataOfTypeExpression(ParameterExpression parameter, string constantKey, Type constantType)
{
if (parameter == null)
{
);
}
- private static Expression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
+ private static MethodCallExpression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
{
if (parameter == null)
{
{
if (!_isDisposed)
{
- IDisposable? innerCatalog = null;
+ AggregateCatalog? innerCatalog = null;
lock (_thisLock)
{
- innerCatalog = _innerCatalog as IDisposable;
+ innerCatalog = _innerCatalog;
_innerCatalog = null;
_isDisposed = true;
}
return exports;
}
- private Export CreateScopeExport(CompositionScopeDefinition childCatalog, ComposablePartDefinition partDefinition, ExportDefinition exportDefinition)
+ private ScopeFactoryExport CreateScopeExport(CompositionScopeDefinition childCatalog, ComposablePartDefinition partDefinition, ExportDefinition exportDefinition)
{
return new ScopeFactoryExport(this, childCatalog, partDefinition, exportDefinition);
}
return exports!;
}
- private IEnumerable<Export> InternalGetExportsCore(ImportDefinition definition, AtomicComposition? atomicComposition)
+ private List<Export> InternalGetExportsCore(ImportDefinition definition, AtomicComposition? atomicComposition)
{
ThrowIfDisposed();
EnsureRunning();
internal static IDictionary<string, object?> GetPartMetadataForType(this Type type, CreationPolicy creationPolicy)
{
- IDictionary<string, object?> dictionary = new Dictionary<string, object?>(StringComparers.MetadataKeyNames);
+ var dictionary = new Dictionary<string, object?>(StringComparers.MetadataKeyNames);
if (creationPolicy != CreationPolicy.Any)
{
return GetExportedValuesCore<T>(contractName);
}
- private IEnumerable<T> GetExportedValuesCore<T>(string? contractName)
+ private Collection<T> GetExportedValuesCore<T>(string? contractName)
{
IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore);
return (export != null) ? ExportServices.GetCastedExportedValue<T>(export) : default;
}
- private IEnumerable<Lazy<T>> GetExportsCore<T>(string? contractName)
+ private Collection<Lazy<T>> GetExportsCore<T>(string? contractName)
{
IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore);
return result;
}
- private IEnumerable<Lazy<T, TMetadataView>> GetExportsCore<T, TMetadataView>(string? contractName)
+ private Collection<Lazy<T, TMetadataView>> GetExportsCore<T, TMetadataView>(string? contractName)
{
IEnumerable<Export> exports = GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ZeroOrMore);
throw new InvalidOperationException(SR.Format(SR.InvalidMetadataView, metadataViewType.Name));
}
- ImportDefinition importDefinition = BuildImportDefinition(type, metadataViewType, contractName, cardinality);
+ ContractBasedImportDefinition importDefinition = BuildImportDefinition(type, metadataViewType, contractName, cardinality);
return GetExports(importDefinition, null);
}
- private static ImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
+ private static ContractBasedImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
{
ArgumentNullException.ThrowIfNull(type);
ArgumentNullException.ThrowIfNull(metadataViewType);
private volatile List<ComposablePartDefinition>? _parts;
private volatile bool _isDisposed;
private readonly ICompositionElement _definitionOrigin;
- private readonly Lazy<IDictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
+ private readonly Lazy<Dictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
/// <summary>
/// Initializes a new instance of the <see cref="TypeCatalog"/> class
InitializeTypeCatalog(types);
_definitionOrigin = this;
- _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+ _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
}
/// <summary>
InitializeTypeCatalog(types);
_definitionOrigin = definitionOrigin;
- _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+ _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
}
/// <summary>
InitializeTypeCatalog(types, reflectionContext);
_definitionOrigin = this;
- _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+ _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
}
/// <summary>
InitializeTypeCatalog(types, reflectionContext);
_definitionOrigin = definitionOrigin;
- _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+ _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
}
private void InitializeTypeCatalog(IEnumerable<Type> types, ReflectionContext reflectionContext)
return contractCandidateParts;
}
- private IDictionary<string, List<ComposablePartDefinition>> CreateIndex()
+ private Dictionary<string, List<ComposablePartDefinition>> CreateIndex()
{
Dictionary<string, List<ComposablePartDefinition>> index = new Dictionary<string, List<ComposablePartDefinition>>(StringComparers.ContractName);
}
}
- private IDictionary<string, object?> TranslateExportMetadata(ReflectionMemberExportDefinition originalExport)
+ private Dictionary<string, object?> TranslateExportMetadata(ReflectionMemberExportDefinition originalExport)
{
Dictionary<string, object?> metadata = new Dictionary<string, object?>(originalExport.Metadata, StringComparers.MetadataKeyNames);
}
}
- private object CastExportsToCollectionImportType(Export[] exports)
+ private Array CastExportsToCollectionImportType(Export[] exports)
{
ArgumentNullException.ThrowIfNull(exports);
private static void SerializeWithBinaryFormatter(Stream o, string cryptoKey, DesigntimeLicenseContext context)
{
- IFormatter formatter = new BinaryFormatter();
+ var formatter = new BinaryFormatter();
#pragma warning disable SYSLIB0011
#pragma warning disable IL2026 // suppressed in ILLink.Suppressions.LibraryBuild.xml
formatter.Serialize(o, new object[] { cryptoKey, context._savedLicenseKeys });
if (EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)
{
#pragma warning disable SYSLIB0011
- IFormatter formatter = new BinaryFormatter();
+ var formatter = new BinaryFormatter();
#pragma warning disable IL2026 // suppressed in ILLink.Suppressions.LibraryBuild.xml
object obj = formatter.Deserialize(wrappedStream);
{
ArgumentNullException.ThrowIfNull(primary);
- Hashtable assocTable = AssociationTable;
- assocTable?.Remove(primary);
+ AssociationTable?.Remove(primary);
}
/// <summary>
return partBuilder;
}
- private IEnumerable<Tuple<object, List<Attribute>>> EvaluateThisTypeInfoAgainstTheConvention(TypeInfo typeInfo)
+ private List<Tuple<object, List<Attribute>>> EvaluateThisTypeInfoAgainstTheConvention(TypeInfo typeInfo)
{
List<Attribute> attributes = new List<Attribute>();
var configuredMembers = new List<Tuple<object, List<Attribute>>>();
{
private readonly object _thisLock = new object();
private readonly ExportDescriptorProvider[] _exportDescriptorProviders;
- private volatile IDictionary<CompositionContract, ExportDescriptor[]> _partDefinitions = new Dictionary<CompositionContract, ExportDescriptor[]>();
+ private volatile Dictionary<CompositionContract, ExportDescriptor[]> _partDefinitions = new Dictionary<CompositionContract, ExportDescriptor[]>();
public ExportDescriptorRegistry(ExportDescriptorProvider[] exportDescriptorProviders)
{
{
private readonly IDictionary<CompositionContract, ExportDescriptor[]> _partDefinitions;
private readonly ExportDescriptorProvider[] _exportDescriptorProviders;
- private readonly IDictionary<CompositionContract, UpdateResult> _updateResults = new Dictionary<CompositionContract, UpdateResult>();
+ private readonly Dictionary<CompositionContract, UpdateResult> _updateResults = new Dictionary<CompositionContract, UpdateResult>();
private static readonly CompositionDependency[] s_noDependenciesValue = Array.Empty<CompositionDependency>();
private static readonly Func<CompositionDependency[]> s_noDependencies = () => s_noDependenciesValue;
private static readonly ExportDescriptorPromise[] s_noPromises = Array.Empty<ExportDescriptorPromise>();
private readonly Queue<ExportDescriptorProvider> _remainingProviders;
- private readonly IList<ExportDescriptorPromise> _providedDescriptors = new List<ExportDescriptorPromise>();
+ private readonly List<ExportDescriptorPromise> _providedDescriptors = new List<ExportDescriptorPromise>();
private ExportDescriptorPromise[] _results;
public UpdateResult(IEnumerable<ExportDescriptorProvider> providers)
public class ContainerConfiguration
{
private AttributedModelProvider _defaultAttributeContext;
- private readonly IList<ExportDescriptorProvider> _addedSources = new List<ExportDescriptorProvider>();
- private readonly IList<Tuple<IEnumerable<Type>, AttributedModelProvider>> _types = new List<Tuple<IEnumerable<Type>, AttributedModelProvider>>();
+ private readonly List<ExportDescriptorProvider> _addedSources = new List<ExportDescriptorProvider>();
+ private readonly List<Tuple<IEnumerable<Type>, AttributedModelProvider>> _types = new List<Tuple<IEnumerable<Type>, AttributedModelProvider>>();
/// <summary>
/// Create the container. The value returned from this method provides
public static ImportInfo GetImportInfo(Type memberType, object[] attributes, object site)
{
var importedContract = new CompositionContract(memberType);
- IDictionary<string, object> importMetadata = null;
+ Dictionary<string, object> importMetadata = null;
var allowDefault = false;
var explicitImportsApplied = 0;
{
private readonly TypeInfo _partType;
private readonly AttributedModelProvider _attributeContext;
- private readonly ICollection<DiscoveredExport> _exports = new List<DiscoveredExport>();
+ private readonly List<DiscoveredExport> _exports = new List<DiscoveredExport>();
private readonly ActivationFeature[] _activationFeatures;
private readonly Lazy<IDictionary<string, object>> _partMetadata;
// This is unbounded so potentially a source of memory consumption,
// but in reality unlikely to be a problem.
- private readonly IList<Type[]> _appliedArguments = new List<Type[]>();
+ private readonly List<Type[]> _appliedArguments = new List<Type[]>();
// Lazily initialised among potentially many exports
private ConstructorInfo _constructor;
{
internal sealed class TypedPartExportDescriptorProvider : ExportDescriptorProvider
{
- private readonly IDictionary<CompositionContract, ICollection<DiscoveredExport>> _discoveredParts = new Dictionary<CompositionContract, ICollection<DiscoveredExport>>();
+ private readonly Dictionary<CompositionContract, ICollection<DiscoveredExport>> _discoveredParts = new Dictionary<CompositionContract, ICollection<DiscoveredExport>>();
public TypedPartExportDescriptorProvider(IEnumerable<Type> types, AttributedModelProvider attributeContext)
{
private static bool FileIsWriteLocked(string fileName)
{
- Stream fileStream = null;
+ FileStream fileStream = null;
if (!File.Exists(fileName))
{
return isUser;
}
- private XmlNode SerializeToXmlElement(SettingsProperty setting, SettingsPropertyValue value)
+ private XmlElement SerializeToXmlElement(SettingsProperty setting, SettingsPropertyValue value)
{
XmlDocument doc = new XmlDocument();
XmlElement valueXml = doc.CreateElement(nameof(value));
private static void CheckPreamble(byte[] preamble, XmlUtilWriter utilWriter, byte[] buffer)
{
bool hasByteOrderMark = false;
- using (Stream preambleStream = new MemoryStream(buffer))
+ using (var preambleStream = new MemoryStream(buffer))
{
byte[] streamStart = new byte[preamble.Length];
if (preambleStream.Read(streamStart, 0, streamStart.Length) == streamStart.Length)
protected virtual DataTable? GetSchemaTable(DbCommand sourceCommand)
{
- using (IDataReader dataReader = sourceCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo))
+ using (DbDataReader dataReader = sourceCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo))
{
return dataReader.GetSchemaTable();
}
/// Func(child[(relation_name)].column_name)
/// When the function is called we have already parsed the Aggregate name, and open paren
/// </summary>
- private ExpressionNode ParseAggregateArgument(FunctionId aggregate)
+ private AggregateNode ParseAggregateArgument(FunctionId aggregate)
{
Debug.Assert(_token == Tokens.LeftParen, "ParseAggregateArgument(): Invalid argument, token <> '('");
_firstCreateReader = true;
}
- private static Stream CreateMemoryStreamFromXmlReader(XmlReader reader)
+ private static MemoryStream CreateMemoryStreamFromXmlReader(XmlReader reader)
{
XmlWriterSettings writerSettings = new XmlWriterSettings();
writerSettings.CloseOutput = false; // don't close the memory stream
return DataSetMapper.GetRowFromElement(e);
}
- private XmlNode? GetRowInsertBeforeLocation(DataRow row, XmlNode parentElement)
+ private XmlElement? GetRowInsertBeforeLocation(DataRow row, XmlNode parentElement)
{
DataRow refRow = row;
int i;
// create new element if we didn't find one.
if (!fFound && !Convert.IsDBNull(value))
{
- XmlElement newElem = new XmlBoundElement(string.Empty, col.EncodedColumnName, col.Namespace, this);
+ var newElem = new XmlBoundElement(string.Empty, col.EncodedColumnName, col.Namespace, this);
newElem.AppendChild(CreateTextNode(col.ConvertObjectToXml(value)));
XmlNode? elemBefore = GetColumnInsertAfterLocation(col, rowElement);
}
#endregion
- private IDisposable SubscribeInternal(IObserver<KeyValuePair<string, object?>> observer,
+ private DiagnosticSubscription SubscribeInternal(IObserver<KeyValuePair<string, object?>> observer,
Predicate<string>? isEnabled1Arg, Func<string, object?, object?, bool>? isEnabled3Arg,
Action<Activity, object?>? onActivityImport, Action<Activity, object?>? onActivityExport)
{
[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode",
Justification = "MakeGenericType is only called when IsDynamicCodeSupported is true or only with ref types.")]
- private static PropertyFetch CreateEnumeratePropertyFetch(Type type, Type enumerableOfTType)
+ private static PropertyFetch CreateEnumeratePropertyFetch(Type type, TypeInfo enumerableOfTType)
{
Type elemType = enumerableOfTType.GetGenericArguments()[0];
#if NETCOREAPP
/// <param name="fd">The file descriptor.</param>
/// <param name="direction">The pipe direction.</param>
/// <returns>The opened stream.</returns>
- private static Stream OpenStream(int fd, PipeDirection direction)
+ private static AnonymousPipeClientStream OpenStream(int fd, PipeDirection direction)
{
Debug.Assert(fd >= 0);
return new AnonymousPipeClientStream(direction, new SafePipeHandle((IntPtr)fd, ownsHandle: true));
return true;
}
- private static Encoding GetEncoding(int codePage)
+ private static ConsoleEncoding GetEncoding(int codePage)
{
Encoding enc = EncodingHelper.GetSupportedConsoleEncoding(codePage);
return new ConsoleEncoding(enc); // ensure encoding doesn't output a preamble
}
}
- private static Encoding GetEncodingWithFallback(Encoding encoding)
- {
- // Clone it and set the "?" replacement fallback
- Encoding fallbackEncoding = (Encoding)encoding.Clone();
- fallbackEncoding.EncoderFallback = EncoderFallback.ReplacementFallback;
- fallbackEncoding.DecoderFallback = DecoderFallback.ReplacementFallback;
-
- return fallbackEncoding;
- }
-
internal void EnsureWriter()
{
if (_writer == null)
// encoding to substitute illegal chars. For ex, In case of high surrogate character
// D800-DBFF without a following low surrogate character DC00-DFFF
// NOTE: We also need to use an encoding that does't emit BOM which is StreamWriter's default
- Encoding noBOMwithFallback = GetEncodingWithFallback(new UTF8Encoding(false));
+ var noBOMwithFallback = (UTF8Encoding)new UTF8Encoding(false).Clone();
+ noBOMwithFallback.EncoderFallback = EncoderFallback.ReplacementFallback;
+ noBOMwithFallback.DecoderFallback = DecoderFallback.ReplacementFallback;
// To support multiple appdomains/instances tracing to the same file,
// we will try to open the given file for append but if we encounter
{
private readonly AsyncLocal<Guid> _activityId = new AsyncLocal<Guid>();
private readonly AsyncLocal<StackNode?> _stack = new AsyncLocal<StackNode?>();
- private readonly Stack _stackWrapper;
+ private readonly AsyncLocalStackWrapper _stackWrapper;
internal CorrelationManager()
{
return FindByDate(principalType, new string[] { "accountExpires" }, matchType, dt);
}
- private ResultSet FindByDate(Type subtype, string[] ldapAttributes, MatchType matchType, DateTime value)
+ private ADEntriesSet FindByDate(Type subtype, string[] ldapAttributes, MatchType matchType, DateTime value)
{
Debug.Assert(ldapAttributes != null);
Debug.Assert(ldapAttributes.Length > 0);
return FindByDate(FindByDateMatcher.DateProperty.AccountExpirationTime, matchType, dt, principalType);
}
- private ResultSet FindByDate(
+ private SAMQuerySet FindByDate(
FindByDateMatcher.DateProperty property,
MatchType matchType,
DateTime value,
// This method retrieves all the values of a property (single valued) from the values
// that were retrieved from the server.
//
- private ICollection GetValuesFromCache(string propertyName)
+ private ArrayList GetValuesFromCache(string propertyName)
{
// retrieve the properties from the server if necessary
InitializePropertiesFromSchemaContainer();
if (_innerList == null)
{
_innerList = new ArrayList();
- IEnumerator enumerator = new ResultsEnumerator(
+ var enumerator = new ResultsEnumerator(
this,
_rootEntry.GetUsername(),
_rootEntry.GetPassword(),
{
Debug.Assert(value != null, "value is null.");
// Try to get memory stream for images with ole header.
- Stream memStream = GetBitmapStream(bytes) ?? new MemoryStream(bytes);
+ MemoryStream memStream = GetBitmapStream(bytes) ?? new MemoryStream(bytes);
return Image.FromStream(memStream);
}
else
public override bool GetPropertiesSupported(ITypeDescriptorContext? context) => true;
- private static unsafe Stream? GetBitmapStream(ReadOnlySpan<byte> rawData)
+ private static unsafe MemoryStream? GetBitmapStream(ReadOnlySpan<byte> rawData)
{
try
{
{
private Graphics? _graphics;
private DeviceContext? _dc;
- private readonly IList _list = new ArrayList();
+ private readonly ArrayList _list = new ArrayList();
public override bool IsPreview => true;
}
// Helper to get the right icon from the given stream that represents an icon.
- private static Image? GetIconFromStream(Stream? stream, bool large, bool scaled)
+ private static Bitmap? GetIconFromStream(Stream? stream, bool large, bool scaled)
{
if (stream == null)
{
return img;
}
- private static Image? GetIconFromResource(Type t, string? bitmapname, bool large, bool scaled)
+ private static Bitmap? GetIconFromResource(Type t, string? bitmapname, bool large, bool scaled)
{
if (bitmapname == null)
{
{
internal static class AsnCharacterStringEncodings
{
- private static readonly Encoding s_utf8Encoding =
- new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
-
- private static readonly Encoding s_bmpEncoding = new BMPEncoding();
- private static readonly Encoding s_ia5Encoding = new IA5Encoding();
- private static readonly Encoding s_visibleStringEncoding = new VisibleStringEncoding();
- private static readonly Encoding s_numericStringEncoding = new NumericStringEncoding();
- private static readonly Encoding s_printableStringEncoding = new PrintableStringEncoding();
- private static readonly Encoding s_t61Encoding = new T61Encoding();
+ private static readonly UTF8Encoding s_utf8Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
+ private static readonly BMPEncoding s_bmpEncoding = new BMPEncoding();
+ private static readonly IA5Encoding s_ia5Encoding = new IA5Encoding();
+ private static readonly VisibleStringEncoding s_visibleStringEncoding = new VisibleStringEncoding();
+ private static readonly NumericStringEncoding s_numericStringEncoding = new NumericStringEncoding();
+ private static readonly PrintableStringEncoding s_printableStringEncoding = new PrintableStringEncoding();
+ private static readonly T61Encoding s_t61Encoding = new T61Encoding();
internal static Encoding GetEncoding(UniversalTagNumber encodingType) =>
encodingType switch
/// </summary>
internal sealed class T61Encoding : Encoding
{
- private static readonly Encoding s_utf8Encoding = new UTF8Encoding(false, throwOnInvalidBytes: true);
+ private static readonly UTF8Encoding s_utf8Encoding = new UTF8Encoding(false, throwOnInvalidBytes: true);
private static readonly Encoding s_latin1Encoding = GetEncoding("iso-8859-1");
public override int GetByteCount(char[] chars, int index, int count)
// Generates a recursive enumeration of the filesystem entries inside the specified source directory, while
// making sure that directory symlinks do not get recursed.
- private static IEnumerable<FileSystemInfo> GetFileSystemEnumerationForCreation(string sourceDirectoryName)
+ private static FileSystemEnumerable<FileSystemInfo> GetFileSystemEnumerationForCreation(string sourceDirectoryName)
{
return new FileSystemEnumerable<FileSystemInfo>(
directory: sourceDirectoryName,
}
// Dumps into the archive stream an extended attribute entry containing metadata of the entry it precedes.
- private static Stream? GenerateExtendedAttributesDataStream(Dictionary<string, string> extendedAttributes)
+ private static MemoryStream? GenerateExtendedAttributesDataStream(Dictionary<string, string> extendedAttributes)
{
MemoryStream? dataStream = null;
return GetDataDecompressor(compressedStream);
}
- private Stream OpenInWriteMode()
+ private WrappedStream OpenInWriteMode()
{
if (_everOpenedForWrite)
throw new IOException(SR.CreateModeWriteOnceAndOneEntryAtATime);
return new WrappedStream(baseStream: _outstandingWriteStream, closeBaseStream: true);
}
- private Stream OpenInUpdateMode()
+ private WrappedStream OpenInUpdateMode()
{
if (_currentlyOpenForWrite)
throw new IOException(SR.UpdateModeOneStream);
#pragma warning restore IDE0060
/// <summary>Gets an exception indicating that named maps are not supported on this platform.</summary>
- private static Exception CreateNamedMapsNotSupportedException()
+ private static PlatformNotSupportedException CreateNamedMapsNotSupportedException()
{
return new PlatformNotSupportedException(SR.PlatformNotSupported_NamedMaps);
}
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) => throw CreateArgumentOutOfRangeException(argument);
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) => new ArgumentOutOfRangeException(argument.ToString());
+ private static ArgumentOutOfRangeException CreateArgumentOutOfRangeException(ExceptionArgument argument) => new ArgumentOutOfRangeException(argument.ToString());
[DoesNotReturn]
internal static void ThrowArgumentNullException(ExceptionArgument argument) => throw CreateArgumentNullException(argument);
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentNullException(ExceptionArgument argument) => new ArgumentNullException(argument.ToString());
+ private static ArgumentNullException CreateArgumentNullException(ExceptionArgument argument) => new ArgumentNullException(argument.ToString());
[DoesNotReturn]
public static void ThrowInvalidOperationException_AlreadyReading() => throw CreateInvalidOperationException_AlreadyReading();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_AlreadyReading() => new InvalidOperationException(SR.ReadingIsInProgress);
+ public static InvalidOperationException CreateInvalidOperationException_AlreadyReading() => new InvalidOperationException(SR.ReadingIsInProgress);
[DoesNotReturn]
public static void ThrowInvalidOperationException_NoReadToComplete() => throw CreateInvalidOperationException_NoReadToComplete();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_NoReadToComplete() => new InvalidOperationException(SR.NoReadingOperationToComplete);
+ public static InvalidOperationException CreateInvalidOperationException_NoReadToComplete() => new InvalidOperationException(SR.NoReadingOperationToComplete);
[DoesNotReturn]
public static void ThrowInvalidOperationException_NoConcurrentOperation() => throw CreateInvalidOperationException_NoConcurrentOperation();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_NoConcurrentOperation() => new InvalidOperationException(SR.ConcurrentOperationsNotSupported);
+ public static InvalidOperationException CreateInvalidOperationException_NoConcurrentOperation() => new InvalidOperationException(SR.ConcurrentOperationsNotSupported);
[DoesNotReturn]
public static void ThrowInvalidOperationException_GetResultNotCompleted() => throw CreateInvalidOperationException_GetResultNotCompleted();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_GetResultNotCompleted() => new InvalidOperationException(SR.GetResultBeforeCompleted);
+ public static InvalidOperationException CreateInvalidOperationException_GetResultNotCompleted() => new InvalidOperationException(SR.GetResultBeforeCompleted);
[DoesNotReturn]
public static void ThrowInvalidOperationException_NoWritingAllowed() => throw CreateInvalidOperationException_NoWritingAllowed();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_NoWritingAllowed() => new InvalidOperationException(SR.WritingAfterCompleted);
+ public static InvalidOperationException CreateInvalidOperationException_NoWritingAllowed() => new InvalidOperationException(SR.WritingAfterCompleted);
[DoesNotReturn]
public static void ThrowInvalidOperationException_NoReadingAllowed() => throw CreateInvalidOperationException_NoReadingAllowed();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_NoReadingAllowed() => new InvalidOperationException(SR.ReadingAfterCompleted);
+ public static InvalidOperationException CreateInvalidOperationException_NoReadingAllowed() => new InvalidOperationException(SR.ReadingAfterCompleted);
[DoesNotReturn]
public static void ThrowInvalidOperationException_InvalidExaminedPosition() => throw CreateInvalidOperationException_InvalidExaminedPosition();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_InvalidExaminedPosition() => new InvalidOperationException(SR.InvalidExaminedPosition);
+ public static InvalidOperationException CreateInvalidOperationException_InvalidExaminedPosition() => new InvalidOperationException(SR.InvalidExaminedPosition);
[DoesNotReturn]
public static void ThrowInvalidOperationException_InvalidExaminedOrConsumedPosition() => throw CreateInvalidOperationException_InvalidExaminedOrConsumedPosition();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_InvalidExaminedOrConsumedPosition() => new InvalidOperationException(SR.InvalidExaminedOrConsumedPosition);
+ public static InvalidOperationException CreateInvalidOperationException_InvalidExaminedOrConsumedPosition() => new InvalidOperationException(SR.InvalidExaminedOrConsumedPosition);
[DoesNotReturn]
public static void ThrowInvalidOperationException_AdvanceToInvalidCursor() => throw CreateInvalidOperationException_AdvanceToInvalidCursor();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_AdvanceToInvalidCursor() => new InvalidOperationException(SR.AdvanceToInvalidCursor);
+ public static InvalidOperationException CreateInvalidOperationException_AdvanceToInvalidCursor() => new InvalidOperationException(SR.AdvanceToInvalidCursor);
[DoesNotReturn]
public static void ThrowInvalidOperationException_ResetIncompleteReaderWriter() => throw CreateInvalidOperationException_ResetIncompleteReaderWriter();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_ResetIncompleteReaderWriter() => new InvalidOperationException(SR.ReaderAndWriterHasToBeCompleted);
+ public static InvalidOperationException CreateInvalidOperationException_ResetIncompleteReaderWriter() => new InvalidOperationException(SR.ReaderAndWriterHasToBeCompleted);
[DoesNotReturn]
public static void ThrowOperationCanceledException_ReadCanceled() => throw CreateOperationCanceledException_ReadCanceled();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateOperationCanceledException_ReadCanceled() => new OperationCanceledException(SR.ReadCanceledOnPipeReader);
+ public static OperationCanceledException CreateOperationCanceledException_ReadCanceled() => new OperationCanceledException(SR.ReadCanceledOnPipeReader);
[DoesNotReturn]
public static void ThrowOperationCanceledException_FlushCanceled() => throw CreateOperationCanceledException_FlushCanceled();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateOperationCanceledException_FlushCanceled() => new OperationCanceledException(SR.FlushCanceledOnPipeWriter);
+ public static OperationCanceledException CreateOperationCanceledException_FlushCanceled() => new OperationCanceledException(SR.FlushCanceledOnPipeWriter);
[DoesNotReturn]
public static void ThrowInvalidOperationException_InvalidZeroByteRead() => throw CreateInvalidOperationException_InvalidZeroByteRead();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateInvalidOperationException_InvalidZeroByteRead() => new InvalidOperationException(SR.InvalidZeroByteRead);
+ public static InvalidOperationException CreateInvalidOperationException_InvalidZeroByteRead() => new InvalidOperationException(SR.InvalidZeroByteRead);
[DoesNotReturn]
public static void ThrowNotSupported_UnflushedBytes() => throw CreateNotSupportedException_UnflushedBytes();
[MethodImpl(MethodImplOptions.NoInlining)]
- public static Exception CreateNotSupportedException_UnflushedBytes() => new NotSupportedException(SR.UnflushedBytesNotSupported);
+ public static NotSupportedException CreateNotSupportedException_UnflushedBytes() => new NotSupportedException(SR.UnflushedBytesNotSupported);
}
internal enum ExceptionArgument
return mo.Expression is ParameterExpression pe && pe.IsByRef;
}
- private static Type MakeNewCustomDelegate(Type[] types)
+ private static System.Reflection.TypeInfo MakeNewCustomDelegate(Type[] types)
{
if (RuntimeFeature.IsDynamicCodeSupported)
{
/// <summary>
/// ArgumentException with message like "reducible nodes must override Expression.Reduce()"
/// </summary>
- internal static Exception ReducibleMustOverrideReduce()
+ internal static ArgumentException ReducibleMustOverrideReduce()
{
return new ArgumentException(Strings.ReducibleMustOverrideReduce);
}
/// <summary>
/// ArgumentException with message like "Argument count must be greater than number of named arguments."
/// </summary>
- internal static Exception ArgCntMustBeGreaterThanNameCnt()
+ internal static ArgumentException ArgCntMustBeGreaterThanNameCnt()
{
return new ArgumentException(Strings.ArgCntMustBeGreaterThanNameCnt);
}
/// <summary>
/// InvalidOperationException with message like "An IDynamicMetaObjectProvider {0} created an invalid DynamicMetaObject instance."
/// </summary>
- internal static Exception InvalidMetaObjectCreated(object? p0)
+ internal static InvalidOperationException InvalidMetaObjectCreated(object? p0)
{
return new InvalidOperationException(Strings.InvalidMetaObjectCreated(p0));
}
/// <summary>
/// System.Reflection.AmbiguousMatchException with message like "More than one key matching '{0}' was found in the ExpandoObject."
/// </summary>
- internal static Exception AmbiguousMatchInExpandoObject(object? p0)
+ internal static AmbiguousMatchException AmbiguousMatchInExpandoObject(object? p0)
{
return new AmbiguousMatchException(Strings.AmbiguousMatchInExpandoObject(p0));
}
/// <summary>
/// ArgumentException with message like "An element with the same key '{0}' already exists in the ExpandoObject."
/// </summary>
- internal static Exception SameKeyExistsInExpando(object? key)
+ internal static ArgumentException SameKeyExistsInExpando(object? key)
{
return new ArgumentException(Strings.SameKeyExistsInExpando(key), nameof(key));
}
/// <summary>
/// System.Collections.Generic.KeyNotFoundException with message like "The specified key '{0}' does not exist in the ExpandoObject."
/// </summary>
- internal static Exception KeyDoesNotExistInExpando(object? p0)
+ internal static KeyNotFoundException KeyDoesNotExistInExpando(object? p0)
{
return new KeyNotFoundException(Strings.KeyDoesNotExistInExpando(p0));
}
/// <summary>
/// InvalidOperationException with message like "Collection was modified; enumeration operation may not execute."
/// </summary>
- internal static Exception CollectionModifiedWhileEnumerating()
+ internal static InvalidOperationException CollectionModifiedWhileEnumerating()
{
return new InvalidOperationException(Strings.CollectionModifiedWhileEnumerating);
}
/// <summary>
/// NotSupportedException with message like "Collection is read-only."
/// </summary>
- internal static Exception CollectionReadOnly()
+ internal static NotSupportedException CollectionReadOnly()
{
return new NotSupportedException(Strings.CollectionReadOnly);
}
/// <summary>
/// ArgumentException with message like "node cannot reduce to itself or null"
/// </summary>
- internal static Exception MustReduceToDifferent()
+ internal static ArgumentException MustReduceToDifferent()
{
return new ArgumentException(Strings.MustReduceToDifferent);
}
/// <summary>
/// InvalidOperationException with message like "The result type '{0}' of the binder '{1}' is not compatible with the result type '{2}' expected by the call site."
/// </summary>
- internal static Exception BinderNotCompatibleWithCallSite(object? p0, object? p1, object? p2)
+ internal static InvalidOperationException BinderNotCompatibleWithCallSite(object? p0, object? p1, object? p2)
{
return new InvalidOperationException(Strings.BinderNotCompatibleWithCallSite(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "The result of the dynamic binding produced by the object with type '{0}' for the binder '{1}' needs at least one restriction."
/// </summary>
- internal static Exception DynamicBindingNeedsRestrictions(object? p0, object? p1)
+ internal static InvalidOperationException DynamicBindingNeedsRestrictions(object? p0, object? p1)
{
return new InvalidOperationException(Strings.DynamicBindingNeedsRestrictions(p0, p1));
}
/// <summary>
/// InvalidCastException with message like "The result type '{0}' of the dynamic binding produced by the object with type '{1}' for the binder '{2}' is not compatible with the result type '{3}' expected by the call site."
/// </summary>
- internal static Exception DynamicObjectResultNotAssignable(object? p0, object? p1, object? p2, object? p3)
+ internal static InvalidCastException DynamicObjectResultNotAssignable(object? p0, object? p1, object? p2, object? p3)
{
return new InvalidCastException(Strings.DynamicObjectResultNotAssignable(p0, p1, p2, p3));
}
/// <summary>
/// InvalidCastException with message like "The result type '{0}' of the dynamic binding produced by binder '{1}' is not compatible with the result type '{2}' expected by the call site."
/// </summary>
- internal static Exception DynamicBinderResultNotAssignable(object? p0, object? p1, object? p2)
+ internal static InvalidCastException DynamicBinderResultNotAssignable(object? p0, object? p1, object? p2)
{
return new InvalidCastException(Strings.DynamicBinderResultNotAssignable(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "Bind cannot return null."
/// </summary>
- internal static Exception BindingCannotBeNull()
+ internal static InvalidOperationException BindingCannotBeNull()
{
return new InvalidOperationException(Strings.BindingCannotBeNull);
}
/// <summary>
/// ArgumentException with message like "cannot assign from the reduced node type to the original node type"
/// </summary>
- internal static Exception ReducedNotCompatible()
+ internal static ArgumentException ReducedNotCompatible()
{
return new ArgumentException(Strings.ReducedNotCompatible);
}
/// <summary>
/// ArgumentException with message like "Setter must have parameters."
/// </summary>
- internal static Exception SetterHasNoParams(string? paramName)
+ internal static ArgumentException SetterHasNoParams(string? paramName)
{
return new ArgumentException(Strings.SetterHasNoParams, paramName);
}
/// <summary>
/// ArgumentException with message like "Property cannot have a managed pointer type."
/// </summary>
- internal static Exception PropertyCannotHaveRefType(string? paramName)
+ internal static ArgumentException PropertyCannotHaveRefType(string? paramName)
{
return new ArgumentException(Strings.PropertyCannotHaveRefType, paramName);
}
/// <summary>
/// ArgumentException with message like "Indexing parameters of getter and setter must match."
/// </summary>
- internal static Exception IndexesOfSetGetMustMatch(string? paramName)
+ internal static ArgumentException IndexesOfSetGetMustMatch(string? paramName)
{
return new ArgumentException(Strings.IndexesOfSetGetMustMatch, paramName);
}
/// <summary>
/// InvalidOperationException with message like "Type parameter is {0}. Expected a delegate."
/// </summary>
- internal static Exception TypeParameterIsNotDelegate(object? p0)
+ internal static InvalidOperationException TypeParameterIsNotDelegate(object? p0)
{
return new InvalidOperationException(Strings.TypeParameterIsNotDelegate(p0));
}
/// <summary>
/// ArgumentException with message like "First argument of delegate must be CallSite"
/// </summary>
- internal static Exception FirstArgumentMustBeCallSite()
+ internal static ArgumentException FirstArgumentMustBeCallSite()
{
return new ArgumentException(Strings.FirstArgumentMustBeCallSite);
}
/// <summary>
/// ArgumentException with message like "Accessor method should not have VarArgs."
/// </summary>
- internal static Exception AccessorsCannotHaveVarArgs(string? paramName)
+ internal static ArgumentException AccessorsCannotHaveVarArgs(string? paramName)
{
return new ArgumentException(Strings.AccessorsCannotHaveVarArgs, paramName);
}
/// <summary>
/// ArgumentException with message like "Accessor indexes cannot be passed ByRef."
/// </summary>
- private static Exception AccessorsCannotHaveByRefArgs(string? paramName)
+ private static ArgumentException AccessorsCannotHaveByRefArgs(string? paramName)
{
return new ArgumentException(Strings.AccessorsCannotHaveByRefArgs, paramName);
}
/// <summary>
/// ArgumentException with message like "Accessor indexes cannot be passed ByRef."
/// </summary>
- internal static Exception AccessorsCannotHaveByRefArgs(string? paramName, int index)
+ internal static ArgumentException AccessorsCannotHaveByRefArgs(string? paramName, int index)
{
return AccessorsCannotHaveByRefArgs(GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Type must be derived from System.Delegate"
/// </summary>
- internal static Exception TypeMustBeDerivedFromSystemDelegate()
+ internal static ArgumentException TypeMustBeDerivedFromSystemDelegate()
{
return new ArgumentException(Strings.TypeMustBeDerivedFromSystemDelegate);
}
/// <summary>
/// InvalidOperationException with message like "No or Invalid rule produced"
/// </summary>
- internal static Exception NoOrInvalidRuleProduced()
+ internal static InvalidOperationException NoOrInvalidRuleProduced()
{
return new InvalidOperationException(Strings.NoOrInvalidRuleProduced);
}
/// <summary>
/// ArgumentException with message like "Bounds count cannot be less than 1"
/// </summary>
- internal static Exception BoundsCannotBeLessThanOne(string? paramName)
+ internal static ArgumentException BoundsCannotBeLessThanOne(string? paramName)
{
return new ArgumentException(Strings.BoundsCannotBeLessThanOne, paramName);
}
/// <summary>
/// ArgumentException with message like "Type must not be ByRef"
/// </summary>
- internal static Exception TypeMustNotBeByRef(string? paramName)
+ internal static ArgumentException TypeMustNotBeByRef(string? paramName)
{
return new ArgumentException(Strings.TypeMustNotBeByRef, paramName);
}
/// <summary>
/// ArgumentException with message like "Type must not be a pointer type"
/// </summary>
- internal static Exception TypeMustNotBePointer(string? paramName)
+ internal static ArgumentException TypeMustNotBePointer(string? paramName)
{
return new ArgumentException(Strings.TypeMustNotBePointer, paramName);
}
/// <summary>
/// ArgumentException with message like "Setter should have void type."
/// </summary>
- internal static Exception SetterMustBeVoid(string? paramName)
+ internal static ArgumentException SetterMustBeVoid(string? paramName)
{
return new ArgumentException(Strings.SetterMustBeVoid, paramName);
}
/// <summary>
/// ArgumentException with message like "Property type must match the value type of getter"
/// </summary>
- internal static Exception PropertyTypeMustMatchGetter(string? paramName)
+ internal static ArgumentException PropertyTypeMustMatchGetter(string? paramName)
{
return new ArgumentException(Strings.PropertyTypeMustMatchGetter, paramName);
}
/// <summary>
/// ArgumentException with message like "Property type must match the value type of setter"
/// </summary>
- internal static Exception PropertyTypeMustMatchSetter(string? paramName)
+ internal static ArgumentException PropertyTypeMustMatchSetter(string? paramName)
{
return new ArgumentException(Strings.PropertyTypeMustMatchSetter, paramName);
}
/// <summary>
/// ArgumentException with message like "Both accessors must be static."
/// </summary>
- internal static Exception BothAccessorsMustBeStatic(string? paramName)
+ internal static ArgumentException BothAccessorsMustBeStatic(string? paramName)
{
return new ArgumentException(Strings.BothAccessorsMustBeStatic, paramName);
}
/// <summary>
/// ArgumentException with message like "Static field requires null instance, non-static field requires non-null instance."
/// </summary>
- internal static Exception OnlyStaticFieldsHaveNullInstance(string? paramName)
+ internal static ArgumentException OnlyStaticFieldsHaveNullInstance(string? paramName)
{
return new ArgumentException(Strings.OnlyStaticFieldsHaveNullInstance, paramName);
}
/// <summary>
/// ArgumentException with message like "Static property requires null instance, non-static property requires non-null instance."
/// </summary>
- internal static Exception OnlyStaticPropertiesHaveNullInstance(string? paramName)
+ internal static ArgumentException OnlyStaticPropertiesHaveNullInstance(string? paramName)
{
return new ArgumentException(Strings.OnlyStaticPropertiesHaveNullInstance, paramName);
}
/// <summary>
/// ArgumentException with message like "Static method requires null instance, non-static method requires non-null instance."
/// </summary>
- internal static Exception OnlyStaticMethodsHaveNullInstance()
+ internal static ArgumentException OnlyStaticMethodsHaveNullInstance()
{
return new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance);
}
/// <summary>
/// ArgumentException with message like "Property cannot have a void type."
/// </summary>
- internal static Exception PropertyTypeCannotBeVoid(string? paramName)
+ internal static ArgumentException PropertyTypeCannotBeVoid(string? paramName)
{
return new ArgumentException(Strings.PropertyTypeCannotBeVoid, paramName);
}
/// <summary>
/// ArgumentException with message like "Can only unbox from an object or interface type to a value type."
/// </summary>
- internal static Exception InvalidUnboxType(string? paramName)
+ internal static ArgumentException InvalidUnboxType(string? paramName)
{
return new ArgumentException(Strings.InvalidUnboxType, paramName);
}
/// <summary>
/// ArgumentException with message like "Expression must be writeable"
/// </summary>
- internal static Exception ExpressionMustBeWriteable(string? paramName)
+ internal static ArgumentException ExpressionMustBeWriteable(string? paramName)
{
return new ArgumentException(Strings.ExpressionMustBeWriteable, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must not have a value type."
/// </summary>
- internal static Exception ArgumentMustNotHaveValueType(string? paramName)
+ internal static ArgumentException ArgumentMustNotHaveValueType(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustNotHaveValueType, paramName);
}
/// <summary>
/// ArgumentException with message like "must be reducible node"
/// </summary>
- internal static Exception MustBeReducible()
+ internal static ArgumentException MustBeReducible()
{
return new ArgumentException(Strings.MustBeReducible);
}
/// <summary>
/// ArgumentException with message like "All test values must have the same type."
/// </summary>
- internal static Exception AllTestValuesMustHaveSameType(string? paramName)
+ internal static ArgumentException AllTestValuesMustHaveSameType(string? paramName)
{
return new ArgumentException(Strings.AllTestValuesMustHaveSameType, paramName);
}
/// <summary>
/// ArgumentException with message like "All case bodies and the default body must have the same type."
/// </summary>
- internal static Exception AllCaseBodiesMustHaveSameType(string? paramName)
+ internal static ArgumentException AllCaseBodiesMustHaveSameType(string? paramName)
{
return new ArgumentException(Strings.AllCaseBodiesMustHaveSameType, paramName);
}
/// <summary>
/// ArgumentException with message like "Default body must be supplied if case bodies are not System.Void."
/// </summary>
- internal static Exception DefaultBodyMustBeSupplied(string? paramName)
+ internal static ArgumentException DefaultBodyMustBeSupplied(string? paramName)
{
return new ArgumentException(Strings.DefaultBodyMustBeSupplied, paramName);
}
/// <summary>
/// ArgumentException with message like "Label type must be System.Void if an expression is not supplied"
/// </summary>
- internal static Exception LabelMustBeVoidOrHaveExpression(string? paramName)
+ internal static ArgumentException LabelMustBeVoidOrHaveExpression(string? paramName)
{
return new ArgumentException(Strings.LabelMustBeVoidOrHaveExpression, paramName);
}
/// <summary>
/// ArgumentException with message like "Type must be System.Void for this label argument"
/// </summary>
- internal static Exception LabelTypeMustBeVoid(string? paramName)
+ internal static ArgumentException LabelTypeMustBeVoid(string? paramName)
{
return new ArgumentException(Strings.LabelTypeMustBeVoid, paramName);
}
/// <summary>
/// ArgumentException with message like "Quoted expression must be a lambda"
/// </summary>
- internal static Exception QuotedExpressionMustBeLambda(string? paramName)
+ internal static ArgumentException QuotedExpressionMustBeLambda(string? paramName)
{
return new ArgumentException(Strings.QuotedExpressionMustBeLambda, paramName);
}
/// <summary>
/// ArgumentException with message like "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables."
/// </summary>
- internal static Exception VariableMustNotBeByRef(object? p0, object? p1, string? paramName)
+ internal static ArgumentException VariableMustNotBeByRef(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.VariableMustNotBeByRef(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables."
/// </summary>
- internal static Exception VariableMustNotBeByRef(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException VariableMustNotBeByRef(object? p0, object? p1, string? paramName, int index)
{
return VariableMustNotBeByRef(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object."
/// </summary>
- private static Exception DuplicateVariable(object? p0, string? paramName)
+ private static ArgumentException DuplicateVariable(object? p0, string? paramName)
{
return new ArgumentException(Strings.DuplicateVariable(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object."
/// </summary>
- internal static Exception DuplicateVariable(object? p0, string? paramName, int index)
+ internal static ArgumentException DuplicateVariable(object? p0, string? paramName, int index)
{
return DuplicateVariable(p0, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Start and End must be well ordered"
/// </summary>
- internal static Exception StartEndMustBeOrdered()
+ internal static ArgumentException StartEndMustBeOrdered()
{
return new ArgumentException(Strings.StartEndMustBeOrdered);
}
/// <summary>
/// ArgumentException with message like "fault cannot be used with catch or finally clauses"
/// </summary>
- internal static Exception FaultCannotHaveCatchOrFinally(string? paramName)
+ internal static ArgumentException FaultCannotHaveCatchOrFinally(string? paramName)
{
return new ArgumentException(Strings.FaultCannotHaveCatchOrFinally, paramName);
}
/// <summary>
/// ArgumentException with message like "try must have at least one catch, finally, or fault clause"
/// </summary>
- internal static Exception TryMustHaveCatchFinallyOrFault()
+ internal static ArgumentException TryMustHaveCatchFinallyOrFault()
{
return new ArgumentException(Strings.TryMustHaveCatchFinallyOrFault);
}
/// <summary>
/// ArgumentException with message like "Body of catch must have the same type as body of try."
/// </summary>
- internal static Exception BodyOfCatchMustHaveSameTypeAsBodyOfTry()
+ internal static ArgumentException BodyOfCatchMustHaveSameTypeAsBodyOfTry()
{
return new ArgumentException(Strings.BodyOfCatchMustHaveSameTypeAsBodyOfTry);
}
/// <summary>
/// InvalidOperationException with message like "Extension node must override the property {0}."
/// </summary>
- internal static Exception ExtensionNodeMustOverrideProperty(object? p0)
+ internal static InvalidOperationException ExtensionNodeMustOverrideProperty(object? p0)
{
return new InvalidOperationException(Strings.ExtensionNodeMustOverrideProperty(p0));
}
/// <summary>
/// ArgumentException with message like "User-defined operator method '{0}' must be static."
/// </summary>
- internal static Exception UserDefinedOperatorMustBeStatic(object? p0, string? paramName)
+ internal static ArgumentException UserDefinedOperatorMustBeStatic(object? p0, string? paramName)
{
return new ArgumentException(Strings.UserDefinedOperatorMustBeStatic(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "User-defined operator method '{0}' must not be void."
/// </summary>
- internal static Exception UserDefinedOperatorMustNotBeVoid(object? p0, string? paramName)
+ internal static ArgumentException UserDefinedOperatorMustNotBeVoid(object? p0, string? paramName)
{
return new ArgumentException(Strings.UserDefinedOperatorMustNotBeVoid(p0), paramName);
}
/// <summary>
/// InvalidOperationException with message like "No coercion operator is defined between types '{0}' and '{1}'."
/// </summary>
- internal static Exception CoercionOperatorNotDefined(object? p0, object? p1)
+ internal static InvalidOperationException CoercionOperatorNotDefined(object? p0, object? p1)
{
return new InvalidOperationException(Strings.CoercionOperatorNotDefined(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "The unary operator {0} is not defined for the type '{1}'."
/// </summary>
- internal static Exception UnaryOperatorNotDefined(object? p0, object? p1)
+ internal static InvalidOperationException UnaryOperatorNotDefined(object? p0, object? p1)
{
return new InvalidOperationException(Strings.UnaryOperatorNotDefined(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "The binary operator {0} is not defined for the types '{1}' and '{2}'."
/// </summary>
- internal static Exception BinaryOperatorNotDefined(object? p0, object? p1, object? p2)
+ internal static InvalidOperationException BinaryOperatorNotDefined(object? p0, object? p1, object? p2)
{
return new InvalidOperationException(Strings.BinaryOperatorNotDefined(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "Reference equality is not defined for the types '{0}' and '{1}'."
/// </summary>
- internal static Exception ReferenceEqualityNotDefined(object? p0, object? p1)
+ internal static InvalidOperationException ReferenceEqualityNotDefined(object? p0, object? p1)
{
return new InvalidOperationException(Strings.ReferenceEqualityNotDefined(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "The operands for operator '{0}' do not match the parameters of method '{1}'."
/// </summary>
- internal static Exception OperandTypesDoNotMatchParameters(object? p0, object? p1)
+ internal static InvalidOperationException OperandTypesDoNotMatchParameters(object? p0, object? p1)
{
return new InvalidOperationException(Strings.OperandTypesDoNotMatchParameters(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "The return type of overload method for operator '{0}' does not match the parameter type of conversion method '{1}'."
/// </summary>
- internal static Exception OverloadOperatorTypeDoesNotMatchConversionType(object? p0, object? p1)
+ internal static InvalidOperationException OverloadOperatorTypeDoesNotMatchConversionType(object? p0, object? p1)
{
return new InvalidOperationException(Strings.OverloadOperatorTypeDoesNotMatchConversionType(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "Conversion is not supported for arithmetic types without operator overloading."
/// </summary>
- internal static Exception ConversionIsNotSupportedForArithmeticTypes()
+ internal static InvalidOperationException ConversionIsNotSupportedForArithmeticTypes()
{
return new InvalidOperationException(Strings.ConversionIsNotSupportedForArithmeticTypes);
}
/// <summary>
/// ArgumentException with message like "Argument type cannot be void"
/// </summary>
- internal static Exception ArgumentTypeCannotBeVoid()
+ internal static ArgumentException ArgumentTypeCannotBeVoid()
{
return new ArgumentException(Strings.ArgumentTypeCannotBeVoid);
}
/// <summary>
/// ArgumentException with message like "Argument must be array"
/// </summary>
- internal static Exception ArgumentMustBeArray(string? paramName)
+ internal static ArgumentException ArgumentMustBeArray(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeArray, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be boolean"
/// </summary>
- internal static Exception ArgumentMustBeBoolean(string? paramName)
+ internal static ArgumentException ArgumentMustBeBoolean(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeBoolean, paramName);
}
/// <summary>
/// ArgumentException with message like "The user-defined equality method '{0}' must return a boolean value."
/// </summary>
- internal static Exception EqualityMustReturnBoolean(object? p0, string? paramName)
+ internal static ArgumentException EqualityMustReturnBoolean(object? p0, string? paramName)
{
return new ArgumentException(Strings.EqualityMustReturnBoolean(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be either a FieldInfo or PropertyInfo"
/// </summary>
- internal static Exception ArgumentMustBeFieldInfoOrPropertyInfo(string? paramName)
+ internal static ArgumentException ArgumentMustBeFieldInfoOrPropertyInfo(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeFieldInfoOrPropertyInfo, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be either a FieldInfo, PropertyInfo or MethodInfo"
/// </summary>
- private static Exception ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(string? paramName)
+ private static ArgumentException ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeFieldInfoOrPropertyInfoOrMethod, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be either a FieldInfo, PropertyInfo or MethodInfo"
/// </summary>
- internal static Exception ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(string? paramName, int index)
+ internal static ArgumentException ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(string? paramName, int index)
{
return ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Argument must be an instance member"
/// </summary>
- private static Exception ArgumentMustBeInstanceMember(string? paramName)
+ private static ArgumentException ArgumentMustBeInstanceMember(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeInstanceMember, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be an instance member"
/// </summary>
- internal static Exception ArgumentMustBeInstanceMember(string? paramName, int index)
+ internal static ArgumentException ArgumentMustBeInstanceMember(string? paramName, int index)
{
return ArgumentMustBeInstanceMember(GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Argument must be of an integer type"
/// </summary>
- private static Exception ArgumentMustBeInteger(string? paramName)
+ private static ArgumentException ArgumentMustBeInteger(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeInteger, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument must be of an integer type"
/// </summary>
- internal static Exception ArgumentMustBeInteger(string? paramName, int index)
+ internal static ArgumentException ArgumentMustBeInteger(string? paramName, int index)
{
return ArgumentMustBeInteger(GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Argument for array index must be of type Int32"
/// </summary>
- internal static Exception ArgumentMustBeArrayIndexType(string? paramName)
+ internal static ArgumentException ArgumentMustBeArrayIndexType(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeArrayIndexType, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument for array index must be of type Int32"
/// </summary>
- internal static Exception ArgumentMustBeArrayIndexType(string? paramName, int index)
+ internal static ArgumentException ArgumentMustBeArrayIndexType(string? paramName, int index)
{
return ArgumentMustBeArrayIndexType(GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Argument must be single-dimensional, zero-based array type"
/// </summary>
- internal static Exception ArgumentMustBeSingleDimensionalArrayType(string? paramName)
+ internal static ArgumentException ArgumentMustBeSingleDimensionalArrayType(string? paramName)
{
return new ArgumentException(Strings.ArgumentMustBeSingleDimensionalArrayType, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument types do not match"
/// </summary>
- internal static Exception ArgumentTypesMustMatch()
+ internal static ArgumentException ArgumentTypesMustMatch()
{
return new ArgumentException(Strings.ArgumentTypesMustMatch);
}
/// <summary>
/// ArgumentException with message like "Argument types do not match"
/// </summary>
- internal static Exception ArgumentTypesMustMatch(string? paramName)
+ internal static ArgumentException ArgumentTypesMustMatch(string? paramName)
{
return new ArgumentException(Strings.ArgumentTypesMustMatch, paramName);
}
/// <summary>
/// InvalidOperationException with message like "Cannot auto initialize elements of value type through property '{0}', use assignment instead"
/// </summary>
- internal static Exception CannotAutoInitializeValueTypeElementThroughProperty(object? p0)
+ internal static InvalidOperationException CannotAutoInitializeValueTypeElementThroughProperty(object? p0)
{
return new InvalidOperationException(Strings.CannotAutoInitializeValueTypeElementThroughProperty(p0));
}
/// <summary>
/// InvalidOperationException with message like "Cannot auto initialize members of value type through property '{0}', use assignment instead"
/// </summary>
- internal static Exception CannotAutoInitializeValueTypeMemberThroughProperty(object? p0)
+ internal static InvalidOperationException CannotAutoInitializeValueTypeMemberThroughProperty(object? p0)
{
return new InvalidOperationException(Strings.CannotAutoInitializeValueTypeMemberThroughProperty(p0));
}
/// <summary>
/// ArgumentException with message like "The type used in TypeAs Expression must be of reference or nullable type, {0} is neither"
/// </summary>
- internal static Exception IncorrectTypeForTypeAs(object? p0, string? paramName)
+ internal static ArgumentException IncorrectTypeForTypeAs(object? p0, string? paramName)
{
return new ArgumentException(Strings.IncorrectTypeForTypeAs(p0), paramName);
}
/// <summary>
/// InvalidOperationException with message like "Coalesce used with type that cannot be null"
/// </summary>
- internal static Exception CoalesceUsedOnNonNullType()
+ internal static InvalidOperationException CoalesceUsedOnNonNullType()
{
return new InvalidOperationException(Strings.CoalesceUsedOnNonNullType);
}
/// <summary>
/// InvalidOperationException with message like "An expression of type '{0}' cannot be used to initialize an array of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeCannotInitializeArrayType(object? p0, object? p1)
+ internal static InvalidOperationException ExpressionTypeCannotInitializeArrayType(object? p0, object? p1)
{
return new InvalidOperationException(Strings.ExpressionTypeCannotInitializeArrayType(p0, p1));
}
/// <summary>
/// ArgumentException with message like " Argument type '{0}' does not match the corresponding member type '{1}'"
/// </summary>
- private static Exception ArgumentTypeDoesNotMatchMember(object? p0, object? p1, string? paramName)
+ private static ArgumentException ArgumentTypeDoesNotMatchMember(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.ArgumentTypeDoesNotMatchMember(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like " Argument type '{0}' does not match the corresponding member type '{1}'"
/// </summary>
- internal static Exception ArgumentTypeDoesNotMatchMember(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException ArgumentTypeDoesNotMatchMember(object? p0, object? p1, string? paramName, int index)
{
return ArgumentTypeDoesNotMatchMember(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like " The member '{0}' is not declared on type '{1}' being created"
/// </summary>
- private static Exception ArgumentMemberNotDeclOnType(object? p0, object? p1, string? paramName)
+ private static ArgumentException ArgumentMemberNotDeclOnType(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.ArgumentMemberNotDeclOnType(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like " The member '{0}' is not declared on type '{1}' being created"
/// </summary>
- internal static Exception ArgumentMemberNotDeclOnType(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException ArgumentMemberNotDeclOnType(object? p0, object? p1, string? paramName, int index)
{
return ArgumentMemberNotDeclOnType(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for return type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchReturn(object? p0, object? p1)
+ internal static ArgumentException ExpressionTypeDoesNotMatchReturn(object? p0, object? p1)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchReturn(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for assignment to type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchAssignment(object? p0, object? p1)
+ internal static ArgumentException ExpressionTypeDoesNotMatchAssignment(object? p0, object? p1)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchAssignment(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for label of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchLabel(object? p0, object? p1)
+ internal static ArgumentException ExpressionTypeDoesNotMatchLabel(object? p0, object? p1)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchLabel(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be invoked"
/// </summary>
- internal static Exception ExpressionTypeNotInvocable(object? p0, string? paramName)
+ internal static ArgumentException ExpressionTypeNotInvocable(object? p0, string? paramName)
{
return new ArgumentException(Strings.ExpressionTypeNotInvocable(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Field '{0}' is not defined for type '{1}'"
/// </summary>
- internal static Exception FieldNotDefinedForType(object? p0, object? p1)
+ internal static ArgumentException FieldNotDefinedForType(object? p0, object? p1)
{
return new ArgumentException(Strings.FieldNotDefinedForType(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Instance field '{0}' is not defined for type '{1}'"
/// </summary>
- internal static Exception InstanceFieldNotDefinedForType(object? p0, object? p1)
+ internal static ArgumentException InstanceFieldNotDefinedForType(object? p0, object? p1)
{
return new ArgumentException(Strings.InstanceFieldNotDefinedForType(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Field '{0}.{1}' is not defined for type '{2}'"
/// </summary>
- internal static Exception FieldInfoNotDefinedForType(object? p0, object? p1, object? p2)
+ internal static ArgumentException FieldInfoNotDefinedForType(object? p0, object? p1, object? p2)
{
return new ArgumentException(Strings.FieldInfoNotDefinedForType(p0, p1, p2));
}
/// <summary>
/// ArgumentException with message like "Incorrect number of indexes"
/// </summary>
- internal static Exception IncorrectNumberOfIndexes()
+ internal static ArgumentException IncorrectNumberOfIndexes()
{
return new ArgumentException(Strings.IncorrectNumberOfIndexes);
}
/// <summary>
/// ArgumentException with message like "Incorrect number of parameters supplied for lambda declaration"
/// </summary>
- internal static Exception IncorrectNumberOfLambdaDeclarationParameters()
+ internal static ArgumentException IncorrectNumberOfLambdaDeclarationParameters()
{
return new ArgumentException(Strings.IncorrectNumberOfLambdaDeclarationParameters);
}
/// <summary>
/// ArgumentException with message like " Incorrect number of members for constructor"
/// </summary>
- internal static Exception IncorrectNumberOfMembersForGivenConstructor()
+ internal static ArgumentException IncorrectNumberOfMembersForGivenConstructor()
{
return new ArgumentException(Strings.IncorrectNumberOfMembersForGivenConstructor);
}
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments for the given members "
/// </summary>
- internal static Exception IncorrectNumberOfArgumentsForMembers()
+ internal static ArgumentException IncorrectNumberOfArgumentsForMembers()
{
return new ArgumentException(Strings.IncorrectNumberOfArgumentsForMembers);
}
/// <summary>
/// ArgumentException with message like "Lambda type parameter must be derived from System.MulticastDelegate"
/// </summary>
- internal static Exception LambdaTypeMustBeDerivedFromSystemDelegate(string? paramName)
+ internal static ArgumentException LambdaTypeMustBeDerivedFromSystemDelegate(string? paramName)
{
return new ArgumentException(Strings.LambdaTypeMustBeDerivedFromSystemDelegate, paramName);
}
/// <summary>
/// ArgumentException with message like "Member '{0}' not field or property"
/// </summary>
- internal static Exception MemberNotFieldOrProperty(object? p0, string? paramName)
+ internal static ArgumentException MemberNotFieldOrProperty(object? p0, string? paramName)
{
return new ArgumentException(Strings.MemberNotFieldOrProperty(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Method {0} contains generic parameters"
/// </summary>
- internal static Exception MethodContainsGenericParameters(object? p0, string? paramName)
+ internal static ArgumentException MethodContainsGenericParameters(object? p0, string? paramName)
{
return new ArgumentException(Strings.MethodContainsGenericParameters(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Method {0} is a generic method definition"
/// </summary>
- internal static Exception MethodIsGeneric(object? p0, string? paramName)
+ internal static ArgumentException MethodIsGeneric(object? p0, string? paramName)
{
return new ArgumentException(Strings.MethodIsGeneric(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "The method '{0}.{1}' is not a property accessor"
/// </summary>
- private static Exception MethodNotPropertyAccessor(object? p0, object? p1, string? paramName)
+ private static ArgumentException MethodNotPropertyAccessor(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.MethodNotPropertyAccessor(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "The method '{0}.{1}' is not a property accessor"
/// </summary>
- internal static Exception MethodNotPropertyAccessor(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException MethodNotPropertyAccessor(object? p0, object? p1, string? paramName, int index)
{
return MethodNotPropertyAccessor(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "The property '{0}' has no 'get' accessor"
/// </summary>
- internal static Exception PropertyDoesNotHaveGetter(object? p0, string? paramName)
+ internal static ArgumentException PropertyDoesNotHaveGetter(object? p0, string? paramName)
{
return new ArgumentException(Strings.PropertyDoesNotHaveGetter(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "The property '{0}' has no 'get' accessor"
/// </summary>
- internal static Exception PropertyDoesNotHaveGetter(object? p0, string? paramName, int index)
+ internal static ArgumentException PropertyDoesNotHaveGetter(object? p0, string? paramName, int index)
{
return PropertyDoesNotHaveGetter(p0, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "The property '{0}' has no 'set' accessor"
/// </summary>
- internal static Exception PropertyDoesNotHaveSetter(object? p0, string? paramName)
+ internal static ArgumentException PropertyDoesNotHaveSetter(object? p0, string? paramName)
{
return new ArgumentException(Strings.PropertyDoesNotHaveSetter(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "The property '{0}' has no 'get' or 'set' accessors"
/// </summary>
- internal static Exception PropertyDoesNotHaveAccessor(object? p0, string? paramName)
+ internal static ArgumentException PropertyDoesNotHaveAccessor(object? p0, string? paramName)
{
return new ArgumentException(Strings.PropertyDoesNotHaveAccessor(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "'{0}' is not a member of type '{1}'"
/// </summary>
- internal static Exception NotAMemberOfType(object? p0, object? p1, string? paramName)
+ internal static ArgumentException NotAMemberOfType(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.NotAMemberOfType(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "'{0}' is not a member of type '{1}'"
/// </summary>
- internal static Exception NotAMemberOfType(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException NotAMemberOfType(object? p0, object? p1, string? paramName, int index)
{
return NotAMemberOfType(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "'{0}' is not a member of any type"
/// </summary>
- internal static Exception NotAMemberOfAnyType(object? p0, string? paramName)
+ internal static ArgumentException NotAMemberOfAnyType(object? p0, string? paramName)
{
return new ArgumentException(Strings.NotAMemberOfAnyType(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "ParameterExpression of type '{0}' cannot be used for delegate parameter of type '{1}'"
/// </summary>
- internal static Exception ParameterExpressionNotValidAsDelegate(object? p0, object? p1)
+ internal static ArgumentException ParameterExpressionNotValidAsDelegate(object? p0, object? p1)
{
return new ArgumentException(Strings.ParameterExpressionNotValidAsDelegate(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Property '{0}' is not defined for type '{1}'"
/// </summary>
- internal static Exception PropertyNotDefinedForType(object? p0, object? p1, string? paramName)
+ internal static ArgumentException PropertyNotDefinedForType(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.PropertyNotDefinedForType(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Instance property '{0}' is not defined for type '{1}'"
/// </summary>
- internal static Exception InstancePropertyNotDefinedForType(object? p0, object? p1, string? paramName)
+ internal static ArgumentException InstancePropertyNotDefinedForType(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.InstancePropertyNotDefinedForType(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Instance property '{0}' that takes no argument is not defined for type '{1}'"
/// </summary>
- internal static Exception InstancePropertyWithoutParameterNotDefinedForType(object? p0, object? p1)
+ internal static ArgumentException InstancePropertyWithoutParameterNotDefinedForType(object? p0, object? p1)
{
return new ArgumentException(Strings.InstancePropertyWithoutParameterNotDefinedForType(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Instance property '{0}{1}' is not defined for type '{2}'"
/// </summary>
- internal static Exception InstancePropertyWithSpecifiedParametersNotDefinedForType(object? p0, object? p1, object? p2, string? paramName)
+ internal static ArgumentException InstancePropertyWithSpecifiedParametersNotDefinedForType(object? p0, object? p1, object? p2, string? paramName)
{
return new ArgumentException(Strings.InstancePropertyWithSpecifiedParametersNotDefinedForType(p0, p1, p2), paramName);
}
/// <summary>
/// ArgumentException with message like "Method '{0}' declared on type '{1}' cannot be called with instance of type '{2}'"
/// </summary>
- internal static Exception InstanceAndMethodTypeMismatch(object? p0, object? p1, object? p2)
+ internal static ArgumentException InstanceAndMethodTypeMismatch(object? p0, object? p1, object? p2)
{
return new ArgumentException(Strings.InstanceAndMethodTypeMismatch(p0, p1, p2));
}
/// <summary>
/// ArgumentException with message like "Type '{0}' does not have a default constructor"
/// </summary>
- internal static Exception TypeMissingDefaultConstructor(object? p0, string? paramName)
+ internal static ArgumentException TypeMissingDefaultConstructor(object? p0, string? paramName)
{
return new ArgumentException(Strings.TypeMissingDefaultConstructor(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Element initializer method must be named 'Add'"
/// </summary>
- internal static Exception ElementInitializerMethodNotAdd(string? paramName)
+ internal static ArgumentException ElementInitializerMethodNotAdd(string? paramName)
{
return new ArgumentException(Strings.ElementInitializerMethodNotAdd, paramName);
}
/// <summary>
/// ArgumentException with message like "Parameter '{0}' of element initializer method '{1}' must not be a pass by reference parameter"
/// </summary>
- internal static Exception ElementInitializerMethodNoRefOutParam(object? p0, object? p1, string? paramName)
+ internal static ArgumentException ElementInitializerMethodNoRefOutParam(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.ElementInitializerMethodNoRefOutParam(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Element initializer method must have at least 1 parameter"
/// </summary>
- internal static Exception ElementInitializerMethodWithZeroArgs(string? paramName)
+ internal static ArgumentException ElementInitializerMethodWithZeroArgs(string? paramName)
{
return new ArgumentException(Strings.ElementInitializerMethodWithZeroArgs, paramName);
}
/// <summary>
/// ArgumentException with message like "Element initializer method must be an instance method"
/// </summary>
- internal static Exception ElementInitializerMethodStatic(string? paramName)
+ internal static ArgumentException ElementInitializerMethodStatic(string? paramName)
{
return new ArgumentException(Strings.ElementInitializerMethodStatic, paramName);
}
/// <summary>
/// ArgumentException with message like "Type '{0}' is not IEnumerable"
/// </summary>
- internal static Exception TypeNotIEnumerable(object? p0, string? paramName)
+ internal static ArgumentException TypeNotIEnumerable(object? p0, string? paramName)
{
return new ArgumentException(Strings.TypeNotIEnumerable(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Unhandled binary: {0}"
/// </summary>
- internal static Exception UnhandledBinary(object? p0, string? paramName)
+ internal static ArgumentException UnhandledBinary(object? p0, string? paramName)
{
return new ArgumentException(Strings.UnhandledBinary(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Unhandled binding "
/// </summary>
- internal static Exception UnhandledBinding()
+ internal static ArgumentException UnhandledBinding()
{
return new ArgumentException(Strings.UnhandledBinding);
}
/// <summary>
/// ArgumentException with message like "Unhandled Binding Type: {0}"
/// </summary>
- internal static Exception UnhandledBindingType(object? p0)
+ internal static ArgumentException UnhandledBindingType(object? p0)
{
return new ArgumentException(Strings.UnhandledBindingType(p0));
}
/// <summary>
/// ArgumentException with message like "Unhandled unary: {0}"
/// </summary>
- internal static Exception UnhandledUnary(object? p0, string? paramName)
+ internal static ArgumentException UnhandledUnary(object? p0, string? paramName)
{
return new ArgumentException(Strings.UnhandledUnary(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Unknown binding type"
/// </summary>
- internal static Exception UnknownBindingType(int index)
+ internal static ArgumentException UnknownBindingType(int index)
{
return new ArgumentException(Strings.UnknownBindingType, $"bindings[{index}]");
}
/// <summary>
/// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must have identical parameter and return types."
/// </summary>
- internal static Exception UserDefinedOpMustHaveConsistentTypes(object? p0, object? p1)
+ internal static ArgumentException UserDefinedOpMustHaveConsistentTypes(object? p0, object? p1)
{
return new ArgumentException(Strings.UserDefinedOpMustHaveConsistentTypes(p0, p1));
}
/// <summary>
/// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must return the same type as its parameter or a derived type."
/// </summary>
- internal static Exception UserDefinedOpMustHaveValidReturnType(object? p0, object? p1)
+ internal static ArgumentException UserDefinedOpMustHaveValidReturnType(object? p0, object? p1)
{
return new ArgumentException(Strings.UserDefinedOpMustHaveValidReturnType(p0, p1));
}
/// <summary>
/// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must have associated boolean True and False operators."
/// </summary>
- internal static Exception LogicalOperatorMustHaveBooleanOperators(object? p0, object? p1)
+ internal static ArgumentException LogicalOperatorMustHaveBooleanOperators(object? p0, object? p1)
{
return new ArgumentException(Strings.LogicalOperatorMustHaveBooleanOperators(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "No method '{0}' on type '{1}' is compatible with the supplied arguments."
/// </summary>
- internal static Exception MethodWithArgsDoesNotExistOnType(object? p0, object? p1)
+ internal static InvalidOperationException MethodWithArgsDoesNotExistOnType(object? p0, object? p1)
{
return new InvalidOperationException(Strings.MethodWithArgsDoesNotExistOnType(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "No generic method '{0}' on type '{1}' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "
/// </summary>
- internal static Exception GenericMethodWithArgsDoesNotExistOnType(object? p0, object? p1)
+ internal static InvalidOperationException GenericMethodWithArgsDoesNotExistOnType(object? p0, object? p1)
{
return new InvalidOperationException(Strings.GenericMethodWithArgsDoesNotExistOnType(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "More than one method '{0}' on type '{1}' is compatible with the supplied arguments."
/// </summary>
- internal static Exception MethodWithMoreThanOneMatch(object? p0, object? p1)
+ internal static InvalidOperationException MethodWithMoreThanOneMatch(object? p0, object? p1)
{
return new InvalidOperationException(Strings.MethodWithMoreThanOneMatch(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "More than one property '{0}' on type '{1}' is compatible with the supplied arguments."
/// </summary>
- internal static Exception PropertyWithMoreThanOneMatch(object? p0, object? p1)
+ internal static InvalidOperationException PropertyWithMoreThanOneMatch(object? p0, object? p1)
{
return new InvalidOperationException(Strings.PropertyWithMoreThanOneMatch(p0, p1));
}
/// <summary>
/// ArgumentException with message like "An incorrect number of type arguments were specified for the declaration of a Func type."
/// </summary>
- internal static Exception IncorrectNumberOfTypeArgsForFunc(string? paramName)
+ internal static ArgumentException IncorrectNumberOfTypeArgsForFunc(string? paramName)
{
return new ArgumentException(Strings.IncorrectNumberOfTypeArgsForFunc, paramName);
}
/// <summary>
/// ArgumentException with message like "An incorrect number of type arguments were specified for the declaration of an Action type."
/// </summary>
- internal static Exception IncorrectNumberOfTypeArgsForAction(string? paramName)
+ internal static ArgumentException IncorrectNumberOfTypeArgsForAction(string? paramName)
{
return new ArgumentException(Strings.IncorrectNumberOfTypeArgsForAction, paramName);
}
/// <summary>
/// ArgumentException with message like "Argument type cannot be System.Void."
/// </summary>
- internal static Exception ArgumentCannotBeOfTypeVoid(string? paramName)
+ internal static ArgumentException ArgumentCannotBeOfTypeVoid(string? paramName)
{
return new ArgumentException(Strings.ArgumentCannotBeOfTypeVoid, paramName);
}
/// <summary>
/// ArgumentOutOfRangeException with message like "{0} must be greater than or equal to {1}"
/// </summary>
- internal static Exception OutOfRange(string? paramName, object? p1)
+ internal static ArgumentException OutOfRange(string? paramName, object? p1)
{
return new ArgumentOutOfRangeException(paramName, Strings.OutOfRange(paramName, p1));
}
/// <summary>
/// InvalidOperationException with message like "Cannot redefine label '{0}' in an inner block."
/// </summary>
- internal static Exception LabelTargetAlreadyDefined(object? p0)
+ internal static InvalidOperationException LabelTargetAlreadyDefined(object? p0)
{
return new InvalidOperationException(Strings.LabelTargetAlreadyDefined(p0));
}
/// <summary>
/// InvalidOperationException with message like "Cannot jump to undefined label '{0}'."
/// </summary>
- internal static Exception LabelTargetUndefined(object? p0)
+ internal static InvalidOperationException LabelTargetUndefined(object? p0)
{
return new InvalidOperationException(Strings.LabelTargetUndefined(p0));
}
/// <summary>
/// InvalidOperationException with message like "Control cannot leave a finally block."
/// </summary>
- internal static Exception ControlCannotLeaveFinally()
+ internal static InvalidOperationException ControlCannotLeaveFinally()
{
return new InvalidOperationException(Strings.ControlCannotLeaveFinally);
}
/// <summary>
/// InvalidOperationException with message like "Control cannot leave a filter test."
/// </summary>
- internal static Exception ControlCannotLeaveFilterTest()
+ internal static InvalidOperationException ControlCannotLeaveFilterTest()
{
return new InvalidOperationException(Strings.ControlCannotLeaveFilterTest);
}
/// <summary>
/// InvalidOperationException with message like "Cannot jump to ambiguous label '{0}'."
/// </summary>
- internal static Exception AmbiguousJump(object? p0)
+ internal static InvalidOperationException AmbiguousJump(object? p0)
{
return new InvalidOperationException(Strings.AmbiguousJump(p0));
}
/// <summary>
/// InvalidOperationException with message like "Control cannot enter a try block."
/// </summary>
- internal static Exception ControlCannotEnterTry()
+ internal static InvalidOperationException ControlCannotEnterTry()
{
return new InvalidOperationException(Strings.ControlCannotEnterTry);
}
/// <summary>
/// InvalidOperationException with message like "Control cannot enter an expression--only statements can be jumped into."
/// </summary>
- internal static Exception ControlCannotEnterExpression()
+ internal static InvalidOperationException ControlCannotEnterExpression()
{
return new InvalidOperationException(Strings.ControlCannotEnterExpression);
}
/// <summary>
/// InvalidOperationException with message like "Cannot jump to non-local label '{0}' with a value. Only jumps to labels defined in outer blocks can pass values."
/// </summary>
- internal static Exception NonLocalJumpWithValue(object? p0)
+ internal static InvalidOperationException NonLocalJumpWithValue(object? p0)
{
return new InvalidOperationException(Strings.NonLocalJumpWithValue(p0));
}
/// <summary>
/// InvalidOperationException with message like "CompileToMethod cannot compile constant '{0}' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value."
/// </summary>
- internal static Exception CannotCompileConstant(object? p0)
+ internal static InvalidOperationException CannotCompileConstant(object? p0)
{
return new InvalidOperationException(Strings.CannotCompileConstant(p0));
}
/// <summary>
/// NotSupportedException with message like "Dynamic expressions are not supported by CompileToMethod. Instead, create an expression tree that uses System.Runtime.CompilerServices.CallSite."
/// </summary>
- internal static Exception CannotCompileDynamic()
+ internal static NotSupportedException CannotCompileDynamic()
{
return new NotSupportedException(Strings.CannotCompileDynamic);
}
/// <summary>
/// ArgumentException with message like "MethodBuilder does not have a valid TypeBuilder"
/// </summary>
- internal static Exception MethodBuilderDoesNotHaveTypeBuilder()
+ internal static ArgumentException MethodBuilderDoesNotHaveTypeBuilder()
{
return new ArgumentException(Strings.MethodBuilderDoesNotHaveTypeBuilder);
}
/// <summary>
/// InvalidOperationException with message like "Invalid lvalue for assignment: {0}."
/// </summary>
- internal static Exception InvalidLvalue(ExpressionType p0)
+ internal static InvalidOperationException InvalidLvalue(ExpressionType p0)
{
return new InvalidOperationException(Strings.InvalidLvalue(p0));
}
/// <summary>
/// InvalidOperationException with message like "variable '{0}' of type '{1}' referenced from scope '{2}', but it is not defined"
/// </summary>
- internal static Exception UndefinedVariable(object? p0, object? p1, object? p2)
+ internal static InvalidOperationException UndefinedVariable(object? p0, object? p1, object? p2)
{
return new InvalidOperationException(Strings.UndefinedVariable(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "Cannot close over byref parameter '{0}' referenced in lambda '{1}'"
/// </summary>
- internal static Exception CannotCloseOverByRef(object? p0, object? p1)
+ internal static InvalidOperationException CannotCloseOverByRef(object? p0, object? p1)
{
return new InvalidOperationException(Strings.CannotCloseOverByRef(p0, p1));
}
/// <summary>
/// InvalidOperationException with message like "Unexpected VarArgs call to method '{0}'"
/// </summary>
- internal static Exception UnexpectedVarArgsCall(object? p0)
+ internal static InvalidOperationException UnexpectedVarArgsCall(object? p0)
{
return new InvalidOperationException(Strings.UnexpectedVarArgsCall(p0));
}
/// <summary>
/// InvalidOperationException with message like "Rethrow statement is valid only inside a Catch block."
/// </summary>
- internal static Exception RethrowRequiresCatch()
+ internal static InvalidOperationException RethrowRequiresCatch()
{
return new InvalidOperationException(Strings.RethrowRequiresCatch);
}
/// <summary>
/// InvalidOperationException with message like "Try expression is not allowed inside a filter body."
/// </summary>
- internal static Exception TryNotAllowedInFilter()
+ internal static InvalidOperationException TryNotAllowedInFilter()
{
return new InvalidOperationException(Strings.TryNotAllowedInFilter);
}
/// <summary>
/// InvalidOperationException with message like "When called from '{0}', rewriting a node of type '{1}' must return a non-null value of the same type. Alternatively, override '{2}' and change it to not visit children of this type."
/// </summary>
- internal static Exception MustRewriteToSameNode(object? p0, object? p1, object? p2)
+ internal static InvalidOperationException MustRewriteToSameNode(object? p0, object? p1, object? p2)
{
return new InvalidOperationException(Strings.MustRewriteToSameNode(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "Rewriting child expression from type '{0}' to type '{1}' is not allowed, because it would change the meaning of the operation. If this is intentional, override '{2}' and change it to allow this rewrite."
/// </summary>
- internal static Exception MustRewriteChildToSameType(object? p0, object? p1, object? p2)
+ internal static InvalidOperationException MustRewriteChildToSameType(object? p0, object? p1, object? p2)
{
return new InvalidOperationException(Strings.MustRewriteChildToSameType(p0, p1, p2));
}
/// <summary>
/// InvalidOperationException with message like "Rewritten expression calls operator method '{0}', but the original node had no operator method. If this is intentional, override '{1}' and change it to allow this rewrite."
/// </summary>
- internal static Exception MustRewriteWithoutMethod(object? p0, object? p1)
+ internal static InvalidOperationException MustRewriteWithoutMethod(object? p0, object? p1)
{
return new InvalidOperationException(Strings.MustRewriteWithoutMethod(p0, p1));
}
/// <summary>
/// NotSupportedException with message like "TryExpression is not supported as an argument to method '{0}' because it has an argument with by-ref type. Construct the tree so the TryExpression is not nested inside of this expression."
/// </summary>
- internal static Exception TryNotSupportedForMethodsWithRefArgs(object? p0)
+ internal static NotSupportedException TryNotSupportedForMethodsWithRefArgs(object? p0)
{
return new NotSupportedException(Strings.TryNotSupportedForMethodsWithRefArgs(p0));
}
/// <summary>
/// NotSupportedException with message like "TryExpression is not supported as a child expression when accessing a member on type '{0}' because it is a value type. Construct the tree so the TryExpression is not nested inside of this expression."
/// </summary>
- internal static Exception TryNotSupportedForValueTypeInstances(object? p0)
+ internal static NotSupportedException TryNotSupportedForValueTypeInstances(object? p0)
{
return new NotSupportedException(Strings.TryNotSupportedForValueTypeInstances(p0));
}
/// <summary>
/// ArgumentException with message like "Test value of type '{0}' cannot be used for the comparison method parameter of type '{1}'"
/// </summary>
- internal static Exception TestValueTypeDoesNotMatchComparisonMethodParameter(object? p0, object? p1)
+ internal static ArgumentException TestValueTypeDoesNotMatchComparisonMethodParameter(object? p0, object? p1)
{
return new ArgumentException(Strings.TestValueTypeDoesNotMatchComparisonMethodParameter(p0, p1));
}
/// <summary>
/// ArgumentException with message like "Switch value of type '{0}' cannot be used for the comparison method parameter of type '{1}'"
/// </summary>
- internal static Exception SwitchValueTypeDoesNotMatchComparisonMethodParameter(object? p0, object? p1)
+ internal static ArgumentException SwitchValueTypeDoesNotMatchComparisonMethodParameter(object? p0, object? p1)
{
return new ArgumentException(Strings.SwitchValueTypeDoesNotMatchComparisonMethodParameter(p0, p1));
}
/// <summary>
/// NotSupportedException with message like "DebugInfoGenerator created by CreatePdbGenerator can only be used with LambdaExpression.CompileToMethod."
/// </summary>
- internal static Exception PdbGeneratorNeedsExpressionCompiler()
+ internal static NotSupportedException PdbGeneratorNeedsExpressionCompiler()
{
return new NotSupportedException(Strings.PdbGeneratorNeedsExpressionCompiler);
}
/// <summary>
/// The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
/// </summary>
- internal static Exception ArgumentOutOfRange(string? paramName)
+ internal static ArgumentOutOfRangeException ArgumentOutOfRange(string? paramName)
{
return new ArgumentOutOfRangeException(paramName);
}
/// <summary>
/// The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.
/// </summary>
- internal static Exception NotSupported()
+ internal static NotSupportedException NotSupported()
{
return new NotSupportedException();
}
/// <summary>
/// ArgumentException with message like "The constructor should not be static"
/// </summary>
- internal static Exception NonStaticConstructorRequired(string? paramName)
+ internal static ArgumentException NonStaticConstructorRequired(string? paramName)
{
return new ArgumentException(Strings.NonStaticConstructorRequired, paramName);
}
/// <summary>
/// InvalidOperationException with message like "Can't compile a NewExpression with a constructor declared on an abstract class"
/// </summary>
- internal static Exception NonAbstractConstructorRequired()
+ internal static InvalidOperationException NonAbstractConstructorRequired()
{
return new InvalidOperationException(Strings.NonAbstractConstructorRequired);
}
/// <summary>
/// InvalidProgramException with default message.
/// </summary>
- internal static Exception InvalidProgram()
+ internal static InvalidProgramException InvalidProgram()
{
return new InvalidProgramException();
}
/// <summary>
/// InvalidOperationException with message like "Enumeration has either not started or has already finished."
/// </summary>
- internal static Exception EnumerationIsDone()
+ internal static InvalidOperationException EnumerationIsDone()
{
return new InvalidOperationException(Strings.EnumerationIsDone);
}
/// <summary>
/// ArgumentException with message like "Type {0} contains generic parameters"
/// </summary>
- private static Exception TypeContainsGenericParameters(object? p0, string? paramName)
+ private static ArgumentException TypeContainsGenericParameters(object? p0, string? paramName)
{
return new ArgumentException(Strings.TypeContainsGenericParameters(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Type {0} contains generic parameters"
/// </summary>
- internal static Exception TypeContainsGenericParameters(object? p0, string? paramName, int index)
+ internal static ArgumentException TypeContainsGenericParameters(object? p0, string? paramName, int index)
{
return TypeContainsGenericParameters(p0, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Type {0} is a generic type definition"
/// </summary>
- internal static Exception TypeIsGeneric(object? p0, string? paramName)
+ internal static ArgumentException TypeIsGeneric(object? p0, string? paramName)
{
return new ArgumentException(Strings.TypeIsGeneric(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Type {0} is a generic type definition"
/// </summary>
- internal static Exception TypeIsGeneric(object? p0, string? paramName, int index)
+ internal static ArgumentException TypeIsGeneric(object? p0, string? paramName, int index)
{
return TypeIsGeneric(p0, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments for constructor"
/// </summary>
- internal static Exception IncorrectNumberOfConstructorArguments()
+ internal static ArgumentException IncorrectNumberOfConstructorArguments()
{
return new ArgumentException(Strings.IncorrectNumberOfConstructorArguments);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchMethodParameter(object? p0, object? p1, object? p2, string? paramName)
+ internal static ArgumentException ExpressionTypeDoesNotMatchMethodParameter(object? p0, object? p1, object? p2, string? paramName)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchMethodParameter(p0, p1, p2), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchMethodParameter(object? p0, object? p1, object? p2, string? paramName, int index)
+ internal static ArgumentException ExpressionTypeDoesNotMatchMethodParameter(object? p0, object? p1, object? p2, string? paramName, int index)
{
return ExpressionTypeDoesNotMatchMethodParameter(p0, p1, p2, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchParameter(object? p0, object? p1, string? paramName)
+ internal static ArgumentException ExpressionTypeDoesNotMatchParameter(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchParameter(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchParameter(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException ExpressionTypeDoesNotMatchParameter(object? p0, object? p1, string? paramName, int index)
{
return ExpressionTypeDoesNotMatchParameter(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// InvalidOperationException with message like "Incorrect number of arguments supplied for lambda invocation"
/// </summary>
- internal static Exception IncorrectNumberOfLambdaArguments()
+ internal static InvalidOperationException IncorrectNumberOfLambdaArguments()
{
return new InvalidOperationException(Strings.IncorrectNumberOfLambdaArguments);
}
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments supplied for call to method '{0}'"
/// </summary>
- internal static Exception IncorrectNumberOfMethodCallArguments(object? p0, string? paramName)
+ internal static ArgumentException IncorrectNumberOfMethodCallArguments(object? p0, string? paramName)
{
return new ArgumentException(Strings.IncorrectNumberOfMethodCallArguments(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object? p0, object? p1, string? paramName)
+ internal static ArgumentException ExpressionTypeDoesNotMatchConstructorParameter(object? p0, object? p1, string? paramName)
{
return new ArgumentException(Strings.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object? p0, object? p1, string? paramName, int index)
+ internal static ArgumentException ExpressionTypeDoesNotMatchConstructorParameter(object? p0, object? p1, string? paramName, int index)
{
return ExpressionTypeDoesNotMatchConstructorParameter(p0, p1, GetParamName(paramName, index));
}
/// <summary>
/// ArgumentException with message like "Expression must be readable"
/// </summary>
- internal static Exception ExpressionMustBeReadable(string? paramName)
+ internal static ArgumentException ExpressionMustBeReadable(string? paramName)
{
return new ArgumentException(Strings.ExpressionMustBeReadable, paramName);
}
/// <summary>
/// ArgumentException with message like "Expression must be readable"
/// </summary>
- internal static Exception ExpressionMustBeReadable(string? paramName, int index)
+ internal static ArgumentException ExpressionMustBeReadable(string? paramName, int index)
{
return ExpressionMustBeReadable(GetParamName(paramName, index));
}
- internal static Exception InvalidArgumentValue(string? paramName)
+ internal static ArgumentException InvalidArgumentValue(string? paramName)
{
return new ArgumentException(Strings.InvalidArgumentValue_ParamName, paramName);
}
- internal static Exception NonEmptyCollectionRequired(string? paramName)
+ internal static ArgumentException NonEmptyCollectionRequired(string? paramName)
{
return new ArgumentException(Strings.NonEmptyCollectionRequired, paramName);
}
- internal static Exception InvalidNullValue(Type? type, string? paramName)
+ internal static ArgumentException InvalidNullValue(Type? type, string? paramName)
{
return new ArgumentException(Strings.InvalidNullValue(type), paramName);
}
- internal static Exception InvalidTypeException(object? value, Type? type, string? paramName)
+ internal static ArgumentException InvalidTypeException(object? value, Type? type, string? paramName)
{
return new ArgumentException(Strings.InvalidObjectType(value?.GetType() as object ?? "null", type), paramName);
}
}
}
- private static IComparer<Pair<bool, TRightKey>> CreateComparer<TRightKey>(IComparer<TRightKey> comparer)
+ private static PairComparer<bool, TRightKey> CreateComparer<TRightKey>(IComparer<TRightKey> comparer)
{
return CreateComparer(Comparer<bool>.Default, comparer);
}
- private static IComparer<Pair<TLeftKey, TRightKey>> CreateComparer<TLeftKey, TRightKey>(IComparer<TLeftKey> leftKeyComparer, IComparer<TRightKey> rightKeyComparer)
+ private static PairComparer<TLeftKey, TRightKey> CreateComparer<TLeftKey, TRightKey>(IComparer<TLeftKey> leftKeyComparer, IComparer<TRightKey> rightKeyComparer)
{
return new PairComparer<TLeftKey, TRightKey>(leftKeyComparer, rightKeyComparer);
}
/// <typeparam name="TElement"></typeparam>
internal sealed class Lookup<TKey, TElement> : ILookup<TKey, TElement> where TKey: notnull
{
- private readonly IDictionary<TKey, IGrouping<TKey, TElement>> _dict;
+ private readonly Dictionary<TKey, IGrouping<TKey, TElement>> _dict;
private readonly IEqualityComparer<TKey> _comparer;
private IGrouping<TKey, TElement>? _defaultKeyGrouping;
//
int count = 0;
- IEnumerator enumCol = this.GetEnumerator();
+ ManagementObjectEnumerator enumCol = this.GetEnumerator();
while (enumCol.MoveNext())
{
count++;
private ManagementClass classobj;
private CodeDomProvider cp;
- private TextWriter tw;
+ private StreamWriter tw;
private readonly string genFileName = string.Empty;
private CodeTypeDeclaration cc;
private CodeTypeDeclaration ccc;
/// <param name="isLiteral"></param>
/// <param name="isBrowsable"></param>
/// <param name="Comment"></param>
- private void GeneratePublicReadOnlyProperty(string propName, string propType, object propValue, bool isLiteral, bool isBrowsable, string Comment)
+ private void GeneratePublicReadOnlyProperty(string propName, string propType, string propValue, bool isLiteral, bool isBrowsable, string Comment)
{
cmp = new CodeMemberProperty();
cmp.Name = propName;
if (isLiteral)
{
- cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(propValue.ToString())));
+ cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(propValue)));
}
else
{
[DoesNotReturn]
internal static void ThrowArgumentNullException(ExceptionArgument argument) { throw CreateArgumentNullException(argument); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentNullException(ExceptionArgument argument) { return new ArgumentNullException(argument.ToString()); }
+ private static ArgumentNullException CreateArgumentNullException(ExceptionArgument argument) { return new ArgumentNullException(argument.ToString()); }
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) { throw CreateArgumentOutOfRangeException(argument); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) { return new ArgumentOutOfRangeException(argument.ToString()); }
+ private static ArgumentOutOfRangeException CreateArgumentOutOfRangeException(ExceptionArgument argument) { return new ArgumentOutOfRangeException(argument.ToString()); }
[DoesNotReturn]
internal static void ThrowInvalidOperationException() { throw CreateInvalidOperationException(); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateInvalidOperationException() { return new InvalidOperationException(); }
+ private static InvalidOperationException CreateInvalidOperationException() { return new InvalidOperationException(); }
[DoesNotReturn]
internal static void ThrowInvalidOperationException_EndPositionNotReached() { throw CreateInvalidOperationException_EndPositionNotReached(); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateInvalidOperationException_EndPositionNotReached() { return new InvalidOperationException(SR.EndPositionNotReached); }
+ private static InvalidOperationException CreateInvalidOperationException_EndPositionNotReached() { return new InvalidOperationException(SR.EndPositionNotReached); }
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException_PositionOutOfRange() { throw CreateArgumentOutOfRangeException_PositionOutOfRange(); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentOutOfRangeException_PositionOutOfRange() { return new ArgumentOutOfRangeException("position"); }
+ private static ArgumentOutOfRangeException CreateArgumentOutOfRangeException_PositionOutOfRange() { return new ArgumentOutOfRangeException("position"); }
[DoesNotReturn]
internal static void ThrowArgumentOutOfRangeException_OffsetOutOfRange() { throw CreateArgumentOutOfRangeException_OffsetOutOfRange(); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateArgumentOutOfRangeException_OffsetOutOfRange() { return new ArgumentOutOfRangeException(nameof(ExceptionArgument.offset)); }
+ private static ArgumentOutOfRangeException CreateArgumentOutOfRangeException_OffsetOutOfRange() { return new ArgumentOutOfRangeException(nameof(ExceptionArgument.offset)); }
//
// ReadOnlySequence .ctor validation Throws coalesced to enable inlining of the .ctor
public static void ThrowStartOrEndArgumentValidationException(long start)
=> throw CreateStartOrEndArgumentValidationException(start);
- private static Exception CreateStartOrEndArgumentValidationException(long start)
+ private static ArgumentOutOfRangeException CreateStartOrEndArgumentValidationException(long start)
{
if (start < 0)
return CreateArgumentOutOfRangeException(ExceptionArgument.start);
public static readonly KnownHeader XUACompatible = new KnownHeader("X-UA-Compatible");
public static readonly KnownHeader XXssProtection = new KnownHeader("X-XSS-Protection", HttpHeaderType.Custom, null, new string[] { "0", "1", "1; mode=block" });
- private static HttpHeaderParser? GetAltSvcHeaderParser() =>
#if TARGET_BROWSER
- // Allow for the AltSvcHeaderParser to be trimmed on Browser since Alt-Svc is only for SocketsHttpHandler, which isn't used on Browser.
- null;
+ private static HttpHeaderParser? GetAltSvcHeaderParser() => null; // Allow for the AltSvcHeaderParser to be trimmed on Browser since Alt-Svc is only for SocketsHttpHandler, which isn't used on Browser.
#else
- AltSvcHeaderParser.Parser;
+ private static AltSvcHeaderParser? GetAltSvcHeaderParser() => AltSvcHeaderParser.Parser;
#endif
// Helper interface for making GetCandidate generic over strings, utf8, etc
return resultLength;
}
- private static MediaTypeHeaderValue CreateMediaType()
- {
- return new MediaTypeHeaderValue();
- }
+ private static MediaTypeHeaderValue CreateMediaType() => new MediaTypeHeaderValue();
- private static MediaTypeHeaderValue CreateMediaTypeWithQuality()
- {
- return new MediaTypeWithQualityHeaderValue();
- }
+ private static MediaTypeWithQualityHeaderValue CreateMediaTypeWithQuality() => new MediaTypeWithQualityHeaderValue();
}
}
return resultLength;
}
- private static TransferCodingHeaderValue CreateTransferCoding()
- {
- return new TransferCodingHeaderValue();
- }
+ private static TransferCodingHeaderValue CreateTransferCoding() => new TransferCodingHeaderValue();
- private static TransferCodingHeaderValue CreateTransferCodingWithQuality()
- {
- return new TransferCodingWithQualityHeaderValue();
- }
+ private static TransferCodingWithQualityHeaderValue CreateTransferCodingWithQuality() => new TransferCodingWithQualityHeaderValue();
}
}
return true;
}
- private MemoryStream? CreateMemoryStream(long maxBufferSize, out Exception? error)
+ private LimitMemoryStream? CreateMemoryStream(long maxBufferSize, out Exception? error)
{
error = null;
return returnFunc(state);
}
- private static Exception CreateOverCapacityException(int maxBufferSize)
+ private static HttpRequestException CreateOverCapacityException(int maxBufferSize)
{
return new HttpRequestException(SR.Format(SR.net_http_content_buffersize_exceeded, maxBufferSize));
}
return stream.WriteAsync(new ReadOnlyMemory<byte>(buffer), cancellationToken);
}
- private static Stream EncodeStringToNewStream(string input)
+ private static MemoryStream EncodeStringToNewStream(string input)
{
return new MemoryStream(HttpRuleParser.DefaultHttpEncoding.GetBytes(input), writable: false);
}
- private Stream EncodeHeadersToNewStream(HttpContent content, bool writeDivider)
+ private MemoryStream EncodeHeadersToNewStream(HttpContent content, bool writeDivider)
{
var stream = new MemoryStream();
SerializeHeadersToStream(stream, content, writeDivider);
return Task.FromCanceled<HttpResponseMessage>(cancellationToken);
}
- HttpMessageHandler handler = _handler ?? SetupHandlerChain();
+ HttpMessageHandlerStage handler = _handler ?? SetupHandlerChain();
Exception? error = ValidateAndNormalizeRequest(request);
if (error != null)
// Utf-8 characters.
internal sealed class HttpListenerRequestUriBuilder
{
- private static readonly Encoding s_utf8Encoding = new UTF8Encoding(false, true);
+ private static readonly UTF8Encoding s_utf8Encoding = new UTF8Encoding(false, true);
private static readonly Encoding s_ansiEncoding = Encoding.GetEncoding(0, new EncoderExceptionFallback(), new DecoderExceptionFallback());
private readonly string _rawUri;
if (close_existing)
{
// Need to copy this since closing will call UnregisterContext
- ICollection keys = _listenerContexts.Keys;
+ Dictionary<HttpListenerContext, HttpListenerContext>.KeyCollection keys = _listenerContexts.Keys;
var all = new HttpListenerContext[keys.Count];
keys.CopyTo(all, 0);
_listenerContexts.Clear();
lock ((_connections as ICollection).SyncRoot)
{
- ICollection keys = _connections.Keys;
+ Dictionary<HttpConnection, HttpConnection>.KeyCollection keys = _connections.Keys;
var conns = new HttpConnection[keys.Count];
keys.CopyTo(conns, 0);
_connections.Clear();
public Guid RequestTraceIdentifier { get; } = Guid.NewGuid();
- private IAsyncResult BeginGetClientCertificateCore(AsyncCallback? requestCallback, object? state)
+ private GetClientCertificateAsyncResult BeginGetClientCertificateCore(AsyncCallback? requestCallback, object? state)
{
var asyncResult = new GetClientCertificateAsyncResult(this, state, requestCallback);
}
if (statusCode != Interop.HttpApi.ERROR_SUCCESS && statusCode != Interop.HttpApi.ERROR_HANDLE_EOF)
{
- Exception exception = new HttpListenerException((int)statusCode);
+ var exception = new HttpListenerException((int)statusCode);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, exception.ToString());
throw exception;
}
}
else
{
- Exception exception = new HttpListenerException((int)statusCode);
+ var exception = new HttpListenerException((int)statusCode);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, exception.ToString());
- asyncResult.InternalCleanup();
throw exception;
}
}
if (statusCode != Interop.HttpApi.ERROR_SUCCESS && statusCode != Interop.HttpApi.ERROR_HANDLE_EOF)
{
- Exception exception = new HttpListenerException((int)statusCode);
+ var exception = new HttpListenerException((int)statusCode);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, exception.ToString());
_closed = true;
_httpContext.Abort();
if (NetEventSource.Log.IsEnabled()) NetEventSource.DumpBuffer(this, buffer, offset, (int)dataToWrite);
}
- private IAsyncResult BeginWriteCore(byte[] buffer, int offset, int size, AsyncCallback? callback, object? state)
+ private HttpResponseStreamAsyncResult BeginWriteCore(byte[] buffer, int offset, int size, AsyncCallback? callback, object? state)
{
Interop.HttpApi.HTTP_FLAGS flags = ComputeLeftToWrite();
if (_closed || (size == 0 && _leftToWrite != 0))
}
else
{
- Exception exception = new HttpListenerException((int)statusCode);
+ var exception = new HttpListenerException((int)statusCode);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, exception.ToString());
_closed = true;
_httpContext.Abort();
}
if (statusCode != Interop.HttpApi.ERROR_SUCCESS && statusCode != Interop.HttpApi.ERROR_HANDLE_EOF)
{
- Exception exception = new HttpListenerException((int)statusCode);
- if (NetEventSource.Log.IsEnabled())
- NetEventSource.Error(this, exception.ToString());
+ var exception = new HttpListenerException((int)statusCode);
+ if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, exception.ToString());
_httpContext.Abort();
throw exception;
}
}
}
- private SafeHandle CreateWebSocketHandle()
+ private SafeWebSocketHandle CreateWebSocketHandle()
{
Debug.Assert(_properties != null, "'_properties' MUST NOT be NULL.");
return WebSocketProtocolComponent.WebSocketCreateServerHandle(
private readonly Base64WriteStateInfo _writeState;
private ReadStateInfo? _readState;
- private readonly IByteEncoder _encoder;
+ private readonly Base64Encoder _encoder;
//bytes with this value in the decode map are invalid
private const byte InvalidBase64Value = 255;
internal Stream GetContentStream() => GetContentStream(null);
- private Stream GetContentStream(MultiAsyncResult? multiResult)
+ private ClosableStream GetContentStream(MultiAsyncResult? multiResult)
{
if (_isInContent)
{
private ReadStateInfo? _readState;
private readonly WriteStateInfoBase _writeState;
- private readonly IByteEncoder _encoder;
+ private readonly QEncoder _encoder;
internal QEncodedStream(WriteStateInfoBase wsi) : base(new MemoryStream())
{
return task;
}
- private static Exception CreateException(SocketError error, int nativeError)
- {
- SocketException e = new SocketException((int)error);
- e.HResult = nativeError;
- return e;
- }
+ private static SocketException CreateException(SocketError error, int nativeError) =>
+ new SocketException((int)error) { HResult = nativeError };
}
}
{
private readonly LinuxNetworkInterface _linuxNetworkInterface;
private readonly GatewayIPAddressInformationCollection _gatewayAddresses;
- private readonly IPAddressCollection _dhcpServerAddresses;
- private readonly IPAddressCollection _winsServerAddresses;
+ private readonly InternalIPAddressCollection _dhcpServerAddresses;
+ private readonly InternalIPAddressCollection _winsServerAddresses;
private readonly LinuxIPv4InterfaceProperties _ipv4Properties;
private readonly LinuxIPv6InterfaceProperties _ipv6Properties;
return new GatewayIPAddressInformationCollection(collection);
}
- private IPAddressCollection GetDhcpServerAddresses()
+ private InternalIPAddressCollection GetDhcpServerAddresses()
{
List<IPAddress> internalCollection = new List<IPAddress>();
return new InternalIPAddressCollection(internalCollection);
}
- private static IPAddressCollection GetWinsServerAddresses()
+ private static InternalIPAddressCollection GetWinsServerAddresses()
{
List<IPAddress> internalCollection
= StringParsingHelpers.ParseWinsServerAddressesFromSmbConfFile(NetworkFiles.SmbConfFile);
}
}
- private static IPAddressCollection? GetDnsAddresses()
+ private static InternalIPAddressCollection? GetDnsAddresses()
{
try
{
private string _method = WebRequestMethods.File.DownloadFile;
private FileAccess _fileAccess = FileAccess.Read;
private ManualResetEventSlim? _blockReaderUntilRequestStreamDisposed;
- private WebResponse? _response;
+ private FileWebResponse? _response;
private WebFileStream? _stream;
private readonly Uri _uri;
private long _contentLength;
public override Uri RequestUri => _uri;
- private static Exception CreateRequestAbortedException() =>
+ private static WebException CreateRequestAbortedException() =>
new WebException(SR.Format(SR.net_requestaborted, WebExceptionStatus.RequestCanceled), WebExceptionStatus.RequestCanceled);
private void CheckAndMarkAsyncGetRequestStreamPending()
}
}
- private Stream CreateWriteStream()
+ private WebFileStream CreateWriteStream()
{
try
{
public override IAsyncResult BeginGetRequestStream(AsyncCallback? callback, object? state)
{
CheckAndMarkAsyncGetRequestStreamPending();
- Task<Stream> t = Task.Factory.StartNew(s => ((FileWebRequest)s!).CreateWriteStream(),
+ Task<Stream> t = Task.Factory.StartNew<Stream>(s => ((FileWebRequest)s!).CreateWriteStream(),
this, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
return TaskToApm.Begin(t, callback, state);
}
public override Task<Stream> GetRequestStreamAsync()
{
CheckAndMarkAsyncGetRequestStreamPending();
- return Task.Factory.StartNew(s =>
+ return Task.Factory.StartNew<Stream>(s =>
{
FileWebRequest thisRef = (FileWebRequest)s!;
Stream writeStream = thisRef.CreateWriteStream();
{
if (disposing)
{
- IDisposable? dataStream = _dataStream;
+ NetworkStream? dataStream = _dataStream;
if (dataStream != null)
{
dataStream.Dispose();
}
private byte[] UploadBits(
- WebRequest request, Stream? readStream, byte[] buffer, int chunkSize,
+ WebRequest request, FileStream? readStream, byte[] buffer, int chunkSize,
byte[]? header, byte[]? footer)
{
try
}
private async void UploadBitsAsync(
- WebRequest request, Stream? readStream, byte[] buffer, int chunkSize,
+ WebRequest request, FileStream? readStream, byte[] buffer, int chunkSize,
byte[]? header, byte[]? footer,
AsyncOperation asyncOp, Action<byte[]?, Exception?, AsyncOperation> completionDelegate)
{
private static void ThrowOperationInProgress(string? methodName) => throw new InvalidOperationException(SR.Format(SR.net_Websockets_AlreadyOneOutstandingOperation, methodName));
/// <summary>Creates an OperationCanceledException instance, using a default message and the specified inner exception and token.</summary>
- private static Exception CreateOperationCanceledException(Exception innerException, CancellationToken cancellationToken = default(CancellationToken))
+ private static OperationCanceledException CreateOperationCanceledException(Exception innerException, CancellationToken cancellationToken = default(CancellationToken))
{
return new OperationCanceledException(
new OperationCanceledException().Message,
object?[]? activationAttributes,
ref StackCrawlMark stackMark)
{
- Assembly assembly;
+ RuntimeAssembly assembly;
if (assemblyString == null)
{
assembly = Assembly.GetExecutingAssembly(ref stackMark);
double IConvertible.ToDouble(IFormatProvider? provider) => throw InvalidCast(nameof(Double));
decimal IConvertible.ToDecimal(IFormatProvider? provider) => throw InvalidCast(nameof(Decimal));
- private static Exception InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to));
+ private static InvalidCastException InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to));
DateTime IConvertible.ToDateTime(IFormatProvider? provider) => this;
#endif
private readonly ResourceManager? resources; // Look up localized strings here.
private readonly EventManifestOptions flags;
- private readonly IList<string> errors; // list of currently encountered errors
+ private readonly List<string> errors; // list of currently encountered errors
private readonly Dictionary<string, List<int>> perEventByteArrayArgIndices; // "event_name" -> List_of_Indices_of_Byte[]_Arg
// State we track between StartEvent and EndEvent.
}
}
- IEnumerator IEnumerable.GetEnumerator()
- {
- var instance = this as IEnumerable<KeyValuePair<string, object?>>;
- return instance.GetEnumerator();
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public void CopyTo(KeyValuePair<string, object?>[] payloadEntries, int count)
{
[DoesNotReturn]
private static void ThrowInvalidRuntimeType(Type enumType) =>
- throw (enumType is not RuntimeType ?
- new ArgumentException(SR.Arg_MustBeType, nameof(enumType)) :
- new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType)));
+ throw new ArgumentException(enumType is not RuntimeType ? SR.Arg_MustBeType : SR.Arg_MustBeEnum, nameof(enumType));
private static void ThrowInvalidEmptyParseArgument() =>
throw new ArgumentException(SR.Arg_MustContainEnumInfo, "value");
[MethodImpl(MethodImplOptions.NoInlining)] // https://github.com/dotnet/runtime/issues/78300
- private static Exception CreateInvalidFormatSpecifierException() =>
+ private static FormatException CreateInvalidFormatSpecifierException() =>
new FormatException(SR.Format_InvalidEnumFormatSpecification);
[MethodImpl(MethodImplOptions.NoInlining)]
- private static Exception CreateUnknownEnumTypeException() =>
+ private static InvalidOperationException CreateUnknownEnumTypeException() =>
new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
public TypeCode GetTypeCode() =>
}
}
- private static IDictionary GetEnvironmentVariablesFromRegistry(bool fromMachine)
+ private static Hashtable GetEnvironmentVariablesFromRegistry(bool fromMachine)
{
var results = new Hashtable();
InternalWriteAllLines(new StreamWriter(path, false, encoding), contents);
}
- private static void InternalWriteAllLines(TextWriter writer, IEnumerable<string> contents)
+ private static void InternalWriteAllLines(StreamWriter writer, IEnumerable<string> contents)
{
Debug.Assert(writer != null);
Debug.Assert(contents != null);
: InternalWriteAllLinesAsync(AsyncStreamWriter(path, encoding, append: false), contents, cancellationToken);
}
- private static async Task InternalWriteAllLinesAsync(TextWriter writer, IEnumerable<string> contents, CancellationToken cancellationToken)
+ private static async Task InternalWriteAllLinesAsync(StreamWriter writer, IEnumerable<string> contents, CancellationToken cancellationToken)
{
Debug.Assert(writer != null);
Debug.Assert(contents != null);
{
}
- private static Stream ValidateArgsAndOpenPath(string path, Encoding encoding, FileStreamOptions options)
+ private static FileStream ValidateArgsAndOpenPath(string path, Encoding encoding, FileStreamOptions options)
{
ArgumentException.ThrowIfNullOrEmpty(path);
ArgumentNullException.ThrowIfNull(encoding);
return new FileStream(path, options);
}
- private static Stream ValidateArgsAndOpenPath(string path, Encoding encoding, int bufferSize)
+ private static FileStream ValidateArgsAndOpenPath(string path, Encoding encoding, int bufferSize)
{
ArgumentException.ThrowIfNullOrEmpty(path);
ArgumentNullException.ThrowIfNull(encoding);
{
}
- private static Stream ValidateArgsAndOpenPath(string path, Encoding encoding, FileStreamOptions options)
+ private static FileStream ValidateArgsAndOpenPath(string path, Encoding encoding, FileStreamOptions options)
{
ArgumentException.ThrowIfNullOrEmpty(path);
ArgumentNullException.ThrowIfNull(encoding);
return new FileStream(path, options);
}
- private static Stream ValidateArgsAndOpenPath(string path, bool append, Encoding encoding, int bufferSize)
+ private static FileStream ValidateArgsAndOpenPath(string path, bool append, Encoding encoding, int bufferSize)
{
ArgumentException.ThrowIfNullOrEmpty(path);
ArgumentNullException.ThrowIfNull(encoding);
return GetOverflowException(type);
}
- private static Exception GetOverflowException(TypeCode type)
+ private static OverflowException GetOverflowException(TypeCode type)
{
string s;
switch (type)
return new OverflowException(s);
}
- private static Exception GetExceptionInt128(ParsingStatus status)
- {
- if (status == ParsingStatus.Failed)
- throw new FormatException(SR.Format_InvalidString);
-
- return new OverflowException(SR.Overflow_Int128);
- }
+ private static Exception GetExceptionInt128(ParsingStatus status) =>
+ status == ParsingStatus.Failed ?
+ new FormatException(SR.Format_InvalidString) :
+ new OverflowException(SR.Overflow_Int128);
- private static Exception GetExceptionUInt128(ParsingStatus status)
- {
- if (status == ParsingStatus.Failed)
- throw new FormatException(SR.Format_InvalidString);
-
- return new OverflowException(SR.Overflow_UInt128);
- }
+ private static Exception GetExceptionUInt128(ParsingStatus status) =>
+ status == ParsingStatus.Failed ?
+ new FormatException(SR.Format_InvalidString) :
+ new OverflowException(SR.Overflow_UInt128);
internal static double NumberToDouble(ref NumberBuffer number)
{
private IDictionaryEnumerator GetEnumeratorHelper()
{
- IDictionary? copyOfTableAsIDictionary = _table; // Avoid a race with Dispose
- if (copyOfTableAsIDictionary == null)
+ Dictionary<object, object?>? table = _table; // Avoid a race with Dispose
+ if (table == null)
throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
// Use IDictionary.GetEnumerator() for backward compatibility. Callers expect the enumerator to return DictionaryEntry instances.
- return copyOfTableAsIDictionary.GetEnumerator();
+ return ((IDictionary)table).GetEnumerator();
}
// Look up a string value for a resource given its name.
Debug.Assert(!continuationTask.IsCompleted, "Did not expect continuationTask to be completed");
// Create a TaskContinuation
- TaskContinuation continuation = new ContinueWithTaskContinuation(continuationTask, options, scheduler);
+ var continuation = new ContinueWithTaskContinuation(continuationTask, options, scheduler);
// If cancellationToken is cancellable, then assign it.
if (cancellationToken.CanBeCanceled)
}
}
- private void LoadParam(object? arg, int oneBasedArgIndex, MethodBase methodInfo)
+ private void LoadParam(object? arg, int oneBasedArgIndex, MethodInfo methodInfo)
{
Load(arg);
if (arg != null)
private SupportedEncoding _encodingCode;
private readonly bool _isReading;
- private Stream _stream = null!; // initialized in InitForXXX
+ private BufferedStream _stream = null!; // initialized in InitForXXX
public JsonEncodingStreamWrapper(Stream stream, Encoding? encoding, bool isReader)
{
return dataNode;
}
- private IDataNode ReadUnknownXmlData(XmlReaderDelegator xmlReader, string? dataContractName, string? dataContractNamespace)
+ private XmlDataNode ReadUnknownXmlData(XmlReaderDelegator xmlReader, string? dataContractName, string? dataContractNamespace)
{
XmlDataNode dataNode = new XmlDataNode()
{
if (xmlReader.NodeType == XmlNodeType.EndElement)
return dataNode;
- IList<XmlAttribute>? xmlAttributes = null;
- IList<XmlNode>? xmlChildNodes = null;
+ List<XmlAttribute>? xmlAttributes = null;
+ List<XmlNode>? xmlChildNodes = null;
XmlNodeType nodeType = xmlReader.MoveToContent();
if (nodeType != XmlNodeType.Text)
bool couldBeClassData = true;
string? elementNs = null, elementName = null;
var xmlChildNodes = new List<XmlNode>();
- IList<XmlAttribute>? xmlAttributes = null;
+ List<XmlAttribute>? xmlAttributes = null;
if (namespaces != null)
{
xmlAttributes = new List<XmlAttribute>();
reader.ReadEndElement();
}
- private static Exception CreateInvalidPrimitiveTypeException(Type type)
+ private static InvalidDataContractException CreateInvalidPrimitiveTypeException(Type type)
{
return new InvalidDataContractException(SR.Format(
type.IsInterface ? SR.InterfaceTypeCannotBeCreated : SR.InvalidPrimitiveType_Serialization,
WriteXmlnsAttribute(ns);
}
- private static Exception CreateInvalidPrimitiveTypeException(Type type)
+ private static InvalidDataContractException CreateInvalidPrimitiveTypeException(Type type)
{
return new InvalidDataContractException(SR.Format(SR.InvalidPrimitiveType_Serialization, DataContract.GetClrTypeFullName(type)));
}
get { return _state == ReadState.Interactive; }
}
- private static XmlNameTable CreateNameTable()
+ private static NameTable CreateNameTable()
{
- XmlNameTable nameTable = new NameTable();
+ var nameTable = new NameTable();
nameTable.Add(string.Empty);
nameTable.Add(XNamespace.xmlnsPrefixNamespace);
nameTable.Add(XNamespace.xmlPrefixNamespace);
return s;
}
- private static XmlNameTable CreateNameTable()
+ private static NameTable CreateNameTable()
{
- XmlNameTable nameTable = new NameTable();
+ var nameTable = new NameTable();
nameTable.Add(string.Empty);
nameTable.Add(xmlnsPrefixNamespace);
nameTable.Add(xmlPrefixNamespace);
// linked list of pushed nametables (to support nested binary-xml documents)
private NestedBinXml? _prevNameInfo;
// XmlTextReader to handle embedded text blocks
- private XmlReader? _textXmlReader;
+ private XmlTextReaderImpl? _textXmlReader;
// close input flag
private readonly bool _closeInput;
break;
default:
- throw ThrowNotSupported(SR.XmlBinary_ListsOfValuesNotSupported);
+ throw CreateNotSupportedException(SR.XmlBinary_ListsOfValuesNotSupported);
}
}
}
if (ScanState.XmlText == _state)
{
Debug.Assert(_textXmlReader != null);
- IXmlNamespaceResolver resolver = (IXmlNamespaceResolver)_textXmlReader;
- return resolver.GetNamespacesInScope(scope);
+ return _textXmlReader.GetNamespacesInScope(scope);
}
else
{
if (ScanState.XmlText == _state)
{
Debug.Assert(_textXmlReader != null);
- IXmlNamespaceResolver resolver = (IXmlNamespaceResolver)_textXmlReader;
- return resolver.LookupPrefix(namespaceName);
+ return _textXmlReader.LookupPrefix(namespaceName);
}
else
{
{
if (_version < requiredVersion)
{
- throw ThrowUnexpectedToken(token);
+ throw CreateUnexpectedTokenException(token);
}
}
while (FillAllowEOF() && ((_pos + require) >= _end))
;
if ((_pos + require) >= _end)
- throw ThrowXmlException(SR.Xml_UnexpectedEOF1);
+ throw CreateXmlException(SR.Xml_UnexpectedEOF1);
}
// inline the common case
// actually has space for 3 more bits.
t = (uint)b & (uint)0x07;
if (b > 7)
- throw ThrowXmlException(SR.XmlBinary_ValueTooBig);
+ throw CreateXmlException(SR.XmlBinary_ValueTooBig);
u += (t << 28);
}
}
// last byte only has 4 significant digits
t = (uint)b & (uint)0x07;
if (b > 7)
- throw ThrowXmlException(SR.XmlBinary_ValueTooBig);
+ throw CreateXmlException(SR.XmlBinary_ValueTooBig);
u += (t << 28);
}
}
}
else if (n.namespaceUri.Length != 0)
{
- throw ThrowXmlException(SR.XmlBinary_AttrWithNsNoPrefix, n.localname, n.namespaceUri);
+ throw CreateXmlException(SR.XmlBinary_AttrWithNsNoPrefix, n.localname, n.namespaceUri);
}
_attrCount++;
lastWasValue = false;
// don't allow lists of values
if (lastWasValue)
{
- throw ThrowNotSupported(SR.XmlBinary_ListsOfValuesNotSupported);
+ throw CreateNotSupportedException(SR.XmlBinary_ListsOfValuesNotSupported);
}
// if char checking is on, we need to scan text values to
return true;
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
return true;
case BinXmlToken.XSD_UNSIGNEDINT:
case BinXmlToken.XSD_UNSIGNEDLONG:
case BinXmlToken.XSD_QNAME:
- throw ThrowNotSupported(SR.XmlBinary_ListsOfValuesNotSupported);
+ throw CreateNotSupportedException(SR.XmlBinary_ListsOfValuesNotSupported);
default:
break;
}
_docState = 3;
break;
case -1:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
default:
break;
}
private void ImplReadEndElement()
{
if (_elemDepth == 0)
- throw ThrowXmlException(SR.Xml_UnexpectedEndTag);
+ throw CreateXmlException(SR.Xml_UnexpectedEndTag);
int index = _elemDepth;
if (1 == index && 3 == _docState)
_docState = -1;
private void ImplReadDoctype()
{
if (_dtdProcessing == DtdProcessing.Prohibit)
- throw ThrowXmlException(SR.Xml_DtdIsProhibited);
+ throw CreateXmlException(SR.Xml_DtdIsProhibited);
// 0=>auto, 1=>doc/pre-dtd, 2=>doc/pre-elem, 3=>doc/instance -1=>doc/post-elem, 9=>frag
switch (_docState)
{
case 1: // 1=>doc/pre-dtd
break;
case 9: // 9=>frag
- throw ThrowXmlException(SR.Xml_DtdNotAllowedInFragment);
+ throw CreateXmlException(SR.Xml_DtdNotAllowedInFragment);
default: // 2=>doc/pre-elem, 3=>doc/instance -1=>doc/post-elem
- throw ThrowXmlException(SR.Xml_BadDTDLocation);
+ throw CreateXmlException(SR.Xml_BadDTDLocation);
}
_docState = 2;
_qnameOther.localname = ParseText();
case 3:
break;
default:
- throw ThrowXmlException(SR.Xml_InvalidRootData);
+ throw CreateXmlException(SR.Xml_InvalidRootData);
}
}
Type? t = s_tokenTypeMap[(int)token];
if (t == null)
- throw ThrowUnexpectedToken(token);
+ throw CreateUnexpectedTokenException(token);
return t;
}
break;
default:
- throw ThrowUnexpectedToken(token);
+ throw CreateUnexpectedTokenException(token);
}
}
Fill(-1);
{
if (!BinaryPrimitives.TryReadUInt16LittleEndian(data, out ushort lowSurr))
{
- throw ThrowXmlException(SR.Xml_InvalidSurrogateMissingLowChar);
+ throw CreateXmlException(SR.Xml_InvalidSurrogateMissingLowChar);
}
if (!XmlCharType.IsLowSurrogate((char)lowSurr))
{
private void CheckValueTokenBounds()
{
if ((_end - _tokDataPos) < _tokLen)
- throw ThrowXmlException(SR.Xml_UnexpectedEOF1);
+ throw CreateXmlException(SR.Xml_UnexpectedEOF1);
}
private int GetXsdKatmaiTokenLength(BinXmlToken token)
scale = _data[_pos];
return 6 + XsdKatmaiTimeScaleToValueLength(scale);
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
}
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
}
else
{
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
}
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
return (double)ValueAsDecimal();
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
return BinXmlDateTime.XsdKatmaiTimeOffsetToDateTime(_data, _tokDataPos);
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
BinXmlToken.XSD_KATMAI_DATEOFFSET => BinXmlDateTime.XsdKatmaiDateOffsetToDateTimeOffset(_data, _tokDataPos),
BinXmlToken.XSD_KATMAI_DATETIMEOFFSET => BinXmlDateTime.XsdKatmaiDateTimeOffsetToDateTimeOffset(_data, _tokDataPos),
BinXmlToken.XSD_KATMAI_TIMEOFFSET => BinXmlDateTime.XsdKatmaiTimeOffsetToDateTimeOffset(_data, _tokDataPos),
- _ => throw ThrowUnexpectedToken(_token),
+ _ => throw CreateUnexpectedTokenException(_token),
};
}
return BinXmlDateTime.XsdKatmaiTimeOffsetToString(_data, _tokDataPos);
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
}
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
catch
}
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
}
}
default:
- throw ThrowUnexpectedToken(_token);
+ throw CreateUnexpectedTokenException(_token);
}
return value;
}
private double GetDouble(int offset) => BinaryPrimitives.ReadDoubleLittleEndian(_data.AsSpan(offset));
- private Exception ThrowUnexpectedToken(BinXmlToken token)
+ private XmlException CreateUnexpectedTokenException(BinXmlToken token)
{
System.Diagnostics.Debug.WriteLine($"Unhandled token: {token}");
- return ThrowXmlException(SR.XmlBinary_UnexpectedToken);
+ return CreateXmlException(SR.XmlBinary_UnexpectedToken);
}
- private Exception ThrowXmlException(string res)
+ private XmlException CreateXmlException(string res)
{
_state = ScanState.Error;
return new XmlException(res, (string[]?)null);
}
- private Exception ThrowXmlException(string res, string arg1, string arg2)
+ private XmlException CreateXmlException(string res, string arg1, string arg2)
{
_state = ScanState.Error;
return new XmlException(res, new string[] { arg1, arg2 });
}
- private Exception ThrowNotSupported(string res)
+ private NotSupportedException CreateNotSupportedException(string res)
{
_state = ScanState.Error;
return new NotSupportedException(res);
}
// Writes the attribute into the provided XmlWriter.
- private void WriteAttributeValue(XmlWriter xtw)
+ private void WriteAttributeValue(XmlTextWriter xtw)
{
string attrName = Name;
while (ReadAttributeValue())
return true;
}
- private Task FinishReadElementContentAsXxxAsync()
+ private Task<bool> FinishReadElementContentAsXxxAsync()
{
if (NodeType != XmlNodeType.EndElement)
{
_ps.appendMode = true;
await ReadDataAsync().ConfigureAwait(false);
}
- private Task InitTextReaderInputAsync(string baseUriStr, TextReader input)
+ private Task<int> InitTextReaderInputAsync(string baseUriStr, TextReader input)
{
return InitTextReaderInputAsync(baseUriStr, null, input);
}
- private Task InitTextReaderInputAsync(string baseUriStr, Uri? baseUri, TextReader input)
+ private Task<int> InitTextReaderInputAsync(string baseUriStr, Uri? baseUri, TextReader input)
{
Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null);
Debug.Assert(baseUriStr != null);
}
}
- private static Exception InvalidCharsException(string name, int badCharIndex)
+ private static ArgumentException InvalidCharsException(string name, int badCharIndex)
{
string[] badCharArgs = XmlException.BuildCharExceptionArgs(name, badCharIndex);
string[] args = new string[3];
_manageNamespaces = true;
}
- _thisNSResolver = this as IXmlNamespaceResolver;
+ _thisNSResolver = this;
_xmlResolver = xmlResolver;
_processInlineSchema = (readerSettings.ValidationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != 0;
return defaultPrefix;
}
- private object? GetNodeValue()
+ private string? GetNodeValue()
{
return _currentNode!.Value;
}
#pragma warning disable 618
// Creates a XmlValidatingReader suitable for parsing InnerXml strings
- private static XmlReader CreateInnerXmlReader(string xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
+ private static XmlTextReaderImpl CreateInnerXmlReader(string xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
{
XmlNodeType contentNT = nt;
if (contentNT == XmlNodeType.Entity || contentNT == XmlNodeType.EntityReference)
}
// Add end marker
- InteriorNode contentRoot = new SequenceNode();
+ var contentRoot = new SequenceNode();
contentRoot.LeftChild = _contentNode;
LeafNode endMarker = new LeafNode(_positions!.Add(_symbols!.AddName(XmlQualifiedName.Empty, null), null));
contentRoot.RightChild = endMarker;
{
private static readonly Type s_atomicValueType = typeof(decimal);
private static readonly Type s_listValueType = typeof(decimal[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(decimal.MinValue, decimal.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(decimal.MinValue, decimal.MaxValue);
internal override XmlValueConverter CreateValueConverter(XmlSchemaType schemaType)
{
{
private static readonly Type s_atomicValueType = typeof(long);
private static readonly Type s_listValueType = typeof(long[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(long.MinValue, long.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(long.MinValue, long.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(int);
private static readonly Type s_listValueType = typeof(int[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(int.MinValue, int.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(int.MinValue, int.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(short);
private static readonly Type s_listValueType = typeof(short[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(short.MinValue, short.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(short.MinValue, short.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(sbyte);
private static readonly Type s_listValueType = typeof(sbyte[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(sbyte.MinValue, sbyte.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(sbyte.MinValue, sbyte.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(ulong);
private static readonly Type s_listValueType = typeof(ulong[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(ulong.MinValue, ulong.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(ulong.MinValue, ulong.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(uint);
private static readonly Type s_listValueType = typeof(uint[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(uint.MinValue, uint.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(uint.MinValue, uint.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(ushort);
private static readonly Type s_listValueType = typeof(ushort[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(ushort.MinValue, ushort.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(ushort.MinValue, ushort.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
{
private static readonly Type s_atomicValueType = typeof(byte);
private static readonly Type s_listValueType = typeof(byte[]);
- private static readonly FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(byte.MinValue, byte.MaxValue);
+ private static readonly Numeric10FacetsChecker s_numeric10FacetsChecker = new Numeric10FacetsChecker(byte.MinValue, byte.MaxValue);
internal override FacetsChecker FacetsChecker { get { return s_numeric10FacetsChecker; } }
}
SchemaInfo? schemaInfo = null;
Uri _baseUri = _xmlResolver.ResolveUri(null, _reader.BaseURI);
- XmlReader? reader = null;
+ XmlTextReader? reader = null;
try
{
Uri ruri = _xmlResolver.ResolveUri(_baseUri, uri.Substring(x_schema.Length));
return;
}
string url = uri.Substring(x_schema.Length);
- XmlReader? reader = null;
+ XmlTextReader? reader = null;
SchemaInfo? xdrSchema = null;
try
{
/// Create an InvalidCastException for cases where either "destinationType" or "sourceType" is not a supported CLR representation
/// for this Xml type.
/// </summary>
- private new Exception CreateInvalidClrMappingException(Type sourceType, Type destinationType)
+ private new InvalidCastException CreateInvalidClrMappingException(Type sourceType, Type destinationType)
{
if (sourceType == destinationType)
return new InvalidCastException(SR.Format(SR.XmlConvert_TypeListBadMapping, XmlTypeName, sourceType.Name));
private void LoadSchemaFromLocation(string uri, string url)
{
- XmlReader? reader = null;
+ XmlTextReader? reader = null;
SchemaInfo? schemaInfo = null;
try
return xmlMapping;
}
- private static Exception ReflectionException(string context, Exception e)
+ private static InvalidOperationException ReflectionException(string context, Exception e)
{
return new InvalidOperationException(SR.Format(SR.XmlReflectionError, context), e);
}
throw new InvalidOperationException(SR.Format(SR.XmlCannotReconcileAccessor, accessor.Name, accessor.Namespace, GetMappingName(existing.Mapping!), GetMappingName(accessor.Mapping!)));
}
- private static Exception CreateReflectionException(string context, Exception e)
+ private static InvalidOperationException CreateReflectionException(string context, Exception e)
{
return new InvalidOperationException(SR.Format(SR.XmlReflectionError, context), e);
}
- private static Exception CreateTypeReflectionException(string context, Exception e)
+ private static InvalidOperationException CreateTypeReflectionException(string context, Exception e)
{
return new InvalidOperationException(SR.Format(SR.XmlTypeReflectionError, context), e);
}
- private static Exception CreateMemberReflectionException(FieldModel model, Exception e)
+ private static InvalidOperationException CreateMemberReflectionException(FieldModel model, Exception e)
{
return new InvalidOperationException(SR.Format(model.IsProperty ? SR.XmlPropertyReflectionError : SR.XmlFieldReflectionError, model.Name), e);
}
_ => throw new ArgumentException(SR.XmlInternalError, nameof(context)),
};
- private static Exception InvalidAttributeUseException(Type type)
+ private static InvalidOperationException InvalidAttributeUseException(Type type)
{
return new InvalidOperationException(SR.Format(SR.XmlInvalidAttributeUse, type.FullName));
}
- private static Exception UnsupportedException(TypeDesc typeDesc, ImportContext context)
+ private static InvalidOperationException UnsupportedException(TypeDesc typeDesc, ImportContext context)
{
return new InvalidOperationException(SR.Format(SR.XmlIllegalTypeContext, typeDesc.FullName, GetContextName(context)));
}
}
}
- private XmlSchemaType ExportMembersMapping(MembersMapping mapping, string? ns)
+ private XmlSchemaComplexType ExportMembersMapping(MembersMapping mapping, string? ns)
{
XmlSchemaComplexType type = new XmlSchemaComplexType();
ExportTypeMembers(type, mapping.Members!, mapping.TypeName!, ns, false, false);
return type;
}
- private XmlSchemaType ExportAnonymousPrimitiveMapping(PrimitiveMapping mapping)
+ private XmlSchemaSimpleType ExportAnonymousPrimitiveMapping(PrimitiveMapping mapping)
{
if (mapping is EnumMapping)
{
}
}
- private XmlSchemaType ExportEnumMapping(EnumMapping mapping, string? ns)
+ private XmlSchemaSimpleType ExportEnumMapping(EnumMapping mapping, string? ns)
{
if (!mapping.IncludeInSchema) throw new InvalidOperationException(SR.Format(SR.XmlCannotIncludeInSchema, mapping.TypeDesc!.Name));
XmlSchemaSimpleType? dataType = (XmlSchemaSimpleType?)_types[mapping];
}
[RequiresUnreferencedCode("calls GetArrayElementType")]
- private object? ReadArray(string? typeName, string? typeNs)
+ private Array? ReadArray(string? typeName, string? typeNs)
{
SoapArrayInfo arrayInfo;
Type? fallbackElementType = null;
}
}
- private Query ProcessVariable(Variable root)
+ private VariableQuery ProcessVariable(Variable root)
{
_needContext = true;
if (!_allowVar)
}
//>> NodeTest ::= NameTest | 'comment ()' | 'text ()' | 'node ()' | 'processing-instruction (' Literal ? ')'
- private AstNode ParseNodeTest(AstNode? qyInput, Axis.AxisType axisType, XPathNodeType nodeType)
+ private Axis ParseNodeTest(AstNode? qyInput, Axis.AxisType axisType, XPathNodeType nodeType)
{
string nodeName, nodePrefix;
return opnd;
}
- private AstNode ParseMethod(AstNode? qyInput)
+ private Function ParseMethod(AstNode? qyInput)
{
List<AstNode> argList = new List<AstNode>();
string name = _scanner.Name;
}
//>> IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')'
- private AstNode? ParseIdKeyPattern()
+ private Function? ParseIdKeyPattern()
{
Debug.Assert(_scanner.CanBeFunction);
List<AstNode> argList = new List<AstNode>();
public virtual void ReplaceSelf(string newNode)
{
- XmlReader reader = CreateContextReader(newNode, false);
+ XmlTextReader reader = CreateContextReader(newNode, false);
ReplaceSelf(reader);
}
}
}
- private static XPathExpression CompileMatchPattern(string xpath)
+ private static CompiledXpathExpr CompileMatchPattern(string xpath)
{
bool hasPrefix;
Query query = new QueryBuilder().BuildPatternQuery(xpath, out hasPrefix);
return false;
}
- private XmlReader CreateReader()
+ private XPathNavigatorReader CreateReader()
{
return XPathNavigatorReader.Create(this);
}
- private XmlReader CreateContextReader(string xml, bool fromCurrentNode)
+ private XmlTextReader CreateContextReader(string xml, bool fromCurrentNode)
{
ArgumentNullException.ThrowIfNull(xml);
/// <summary>
/// Remove unused global functions, variables, or parameters from the list.
/// </summary>
- private static void EliminateUnusedGlobals(IList<QilNode> globals)
+ private static void EliminateUnusedGlobals(QilList globals)
{
int newIdx = 0;
/// <summary>
/// Generate code to combine nodes from two nested iterators using Union, Intersection, or Difference semantics.
/// </summary>
- private QilNode CreateSetIterator(QilBinary ndSet, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent)
+ private QilBinary CreateSetIterator(QilBinary ndSet, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent)
{
LocalBuilder locIter, locNav;
Label lblNext, lblCall, lblNextLeft, lblNextRight, lblInitRight;
/// <summary>
/// Generate code for QilNodeType.Sum, QilNodeType.Average, QilNodeType.Minimum, and QilNodeType.Maximum.
/// </summary>
- private QilNode CreateAggregator(QilUnary ndAgg, string aggName, XmlILStorageMethods methods, MethodInfo methAgg, MethodInfo methResult)
+ private QilUnary CreateAggregator(QilUnary ndAgg, string aggName, XmlILStorageMethods methods, MethodInfo methAgg, MethodInfo methResult)
{
Label lblOnEnd = _helper.DefineLabel();
Type typAgg = methAgg.DeclaringType!;
/// <summary>
/// Generate code for two-argument arithmetic operations.
/// </summary>
- private QilNode ArithmeticOp(QilBinary ndOp)
+ private QilBinary ArithmeticOp(QilBinary ndOp)
{
NestedVisitEnsureStack(ndOp.Left, ndOp.Right);
_helper.CallArithmeticOp(ndOp.NodeType, ndOp.XmlType!.TypeCode);
/// <summary>
/// Generate code for QilNodeType.TextCtor and QilNodeType.RawTextCtor.
/// </summary>
- private QilNode VisitTextCtor(QilUnary ndText, bool disableOutputEscaping)
+ private QilUnary VisitTextCtor(QilUnary ndText, bool disableOutputEscaping)
{
XmlILConstructInfo info = XmlILConstructInfo.Read(ndText);
bool callChk;
/// <summary>
/// Generate code to push the local name, namespace uri, or qname of the context navigator.
/// </summary>
- private QilNode VisitNodeProperty(QilUnary ndProp)
+ private QilUnary VisitNodeProperty(QilUnary ndProp)
{
// Generate code to push argument onto stack
NestedVisitEnsureStack(ndProp.Child);
private QilValidationVisitor() { }
#if DEBUG
- private Hashtable allNodes = new ObjectHashtable();
- private Hashtable parents = new ObjectHashtable();
- private Hashtable scope = new ObjectHashtable();
+ private readonly ObjectHashtable allNodes = new ObjectHashtable();
+ private readonly ObjectHashtable parents = new ObjectHashtable();
+ private readonly ObjectHashtable scope = new ObjectHashtable();
//-----------------------------------------------
// REVIEW: Can we handle both sort's and with-param's in the document order?
// CompileSorts() creates helper variables in varHelper
- private QilNode? CompileSorts(IList<XslNode> content, ref LoopFocus parentLoop)
+ private QilList? CompileSorts(IList<XslNode> content, ref LoopFocus parentLoop)
{
QilList keyList = _f.BaseFactory.SortKeyList();
private const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static;
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2075:RequiresUnreferencedCode",
Justification = XsltArgumentList.ExtensionObjectSuppresion)]
- private IXsltContextFunction? GetExtensionMethod(string ns, string name, XPathResultType[]? argTypes, out object? extension)
+ private FuncExtension? GetExtensionMethod(string ns, string name, XPathResultType[]? argTypes, out object? extension)
{
FuncExtension? result = null;
extension = _processor!.GetScriptObject(ns);
protected abstract Type ComputeEventHandlerType();
private volatile Type? _lazyEventType;
- private MethodInfo? GetRoAddMethod() => (_lazyAdder == Sentinels.RoMethod) ? (_lazyAdder = ComputeEventAddMethod()?.FilterInheritedAccessor()) : _lazyAdder;
- private MethodInfo? GetRoRemoveMethod() => (_lazyRemover == Sentinels.RoMethod) ? (_lazyRemover = ComputeEventRemoveMethod()?.FilterInheritedAccessor()) : _lazyRemover;
- private MethodInfo? GetRoRaiseMethod() => (_lazyRaiser == Sentinels.RoMethod) ? (_lazyRaiser = ComputeEventRaiseMethod()?.FilterInheritedAccessor()) : _lazyRaiser;
+ private RoMethod? GetRoAddMethod() => (_lazyAdder == Sentinels.RoMethod) ? (_lazyAdder = ComputeEventAddMethod()?.FilterInheritedAccessor()) : _lazyAdder;
+ private RoMethod? GetRoRemoveMethod() => (_lazyRemover == Sentinels.RoMethod) ? (_lazyRemover = ComputeEventRemoveMethod()?.FilterInheritedAccessor()) : _lazyRemover;
+ private RoMethod? GetRoRaiseMethod() => (_lazyRaiser == Sentinels.RoMethod) ? (_lazyRaiser = ComputeEventRaiseMethod()?.FilterInheritedAccessor()) : _lazyRaiser;
public sealed override MethodInfo? GetAddMethod(bool nonPublic) => GetRoAddMethod()?.FilterAccessor(nonPublic);
public sealed override MethodInfo? GetRemoveMethod(bool nonPublic) => GetRoRemoveMethod()?.FilterAccessor(nonPublic);
/// </summary>
internal sealed partial class RoDefinitionMethod<TMethodDecoder>
{
- private CustomAttributeData? ComputeDllImportCustomAttributeDataIfAny()
+ private RoPseudoCustomAttributeData? ComputeDllImportCustomAttributeDataIfAny()
{
if ((Attributes & MethodAttributes.PinvokeImpl) == 0)
return null;
// a collection of primitive types in a dictionary, indexed by type name
// using a comparer which handles type name comparisons similar to what
// is done by reflection
- private static readonly IReadOnlyDictionary<string, Type> s_primitiveTypes = new Dictionary<string, Type>(16, TypeNameComparer.Instance)
+ private static readonly Dictionary<string, Type> s_primitiveTypes = new Dictionary<string, Type>(16, TypeNameComparer.Instance)
{
{ typeof(string).FullName!, typeof(string) },
{ typeof(int).FullName!, typeof(int) },
IdentifierName(Constants.ArgumentReturn), IdentifierName("Initialize")))));
}
- private StatementSyntax InvokeSyntax()
+ private ExpressionStatementSyntax InvokeSyntax()
{
return ExpressionStatement(InvocationExpression(
MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName("InvokeJS")))
}
}
- private StatementSyntax ToManagedMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info)
+ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info)
{
List<ArgumentSyntax> arguments = new List<ArgumentSyntax>();
arguments.Add(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)));
.WithArgumentList(ArgumentList(SeparatedList(arguments))));
}
- private StatementSyntax ToJSMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info)
+ private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, JSFunctionTypeInfo info)
{
List<ArgumentSyntax> arguments = new List<ArgumentSyntax>();
arguments.Add(source);
return argument;
}
- private StatementSyntax ToManagedMethod(string target, ArgumentSyntax source)
+ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToManagedMethod(Type)))
.WithArgumentList(ArgumentList(SingletonSeparatedList(ToManagedMethodRefOrOut(source)))));
}
- private StatementSyntax ToJSMethod(string target, ArgumentSyntax source)
+ private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToJSMethod(Type)))
}
}
- private StatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source)
+ private ExpressionStatementSyntax ToManagedMethodVoid(string target, ArgumentSyntax source)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToManagedMethod(Type)))
.WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))))));
}
- private StatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source)
+ private ExpressionStatementSyntax ToJSMethodVoid(string target, ArgumentSyntax source)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToJSMethod(Type)))
.WithArgumentList(ArgumentList(SingletonSeparatedList(source))));
}
- private StatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
+ private ExpressionStatementSyntax ToManagedMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToManagedMethod(Type)))
}))))))))}))));
}
- private StatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
+ private ExpressionStatementSyntax ToJSMethod(string target, ArgumentSyntax source, TypeSyntax sourceType)
{
return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
IdentifierName(target), GetToJSMethod(Type)))
return new SyntaxTokenList(strippedTokens);
}
- private static MemberDeclarationSyntax PrintGeneratedSource(
+ private static MethodDeclarationSyntax PrintGeneratedSource(
ContainingSyntax userDeclaredMethod,
SignatureContext stub,
BlockSyntax stubCode)
return statementsToUpdate.ToImmutable();
}
- private static StatementSyntax GenerateStatementForNativeInvoke(BoundGenerators marshallers, StubCodeContext context, ExpressionSyntax expressionToInvoke)
+ private static ExpressionStatementSyntax GenerateStatementForNativeInvoke(BoundGenerators marshallers, StubCodeContext context, ExpressionSyntax expressionToInvoke)
{
if (context.CurrentStage != StubCodeContext.Stage.Invoke)
{
}
- private static StatementSyntax GenerateStatementForManagedInvoke(BoundGenerators marshallers, StubCodeContext context, ExpressionSyntax expressionToInvoke)
+ private static ExpressionStatementSyntax GenerateStatementForManagedInvoke(BoundGenerators marshallers, StubCodeContext context, ExpressionSyntax expressionToInvoke)
{
if (context.CurrentStage != StubCodeContext.Stage.Invoke)
{
}
// This is called by AppDomain.GetThreadPrincipal() via reflection.
- private static IPrincipal GetDefaultInstance() => new GenericPrincipal(new GenericIdentity(string.Empty), new string[] { string.Empty });
+ private static GenericPrincipal GetDefaultInstance() => new GenericPrincipal(new GenericIdentity(string.Empty), new string[] { string.Empty });
}
}
return CreateInvalidMessageTypeException();
}
- private static Exception CreateInvalidMessageTypeException()
+ private static CryptographicException CreateInvalidMessageTypeException()
{
// Windows CRYPT_E_INVALID_MSG_TYPE
return new CryptographicException(SR.Cryptography_Cms_InvalidMessageType);
}
}
- private static Exception? TryGetKeySpecForCertificate(X509Certificate2 cert, out CryptKeySpec keySpec)
+ private static CryptographicException? TryGetKeySpecForCertificate(X509Certificate2 cert, out CryptKeySpec keySpec)
{
using (SafeCertContextHandle hCertContext = cert.CreateCertContextHandle())
{
}
}
- private unsafe Exception? TryDecryptTrans(KeyTransRecipientInfo recipientInfo, SafeProvOrNCryptKeyHandle hKey, CryptKeySpec keySpec)
+ private unsafe CryptographicException? TryDecryptTrans(KeyTransRecipientInfo recipientInfo, SafeProvOrNCryptKeyHandle hKey, CryptKeySpec keySpec)
{
KeyTransRecipientInfoPalWindows pal = (KeyTransRecipientInfoPalWindows)(recipientInfo.Pal);
}
}
- private Exception? TryExecuteDecryptAgree(ref CMSG_CTRL_KEY_AGREE_DECRYPT_PARA decryptPara)
+ private CryptographicException? TryExecuteDecryptAgree(ref CMSG_CTRL_KEY_AGREE_DECRYPT_PARA decryptPara)
{
if (!Interop.Crypt32.CryptMsgControl(_hCryptMsg, 0, MsgControlType.CMSG_CTRL_KEY_AGREE_DECRYPT, ref decryptPara))
{
throw new ArgumentNullException(nameof(cipherData));
}
- Stream? inputStream = null;
+ MemoryStream? inputStream = null;
if (cipherData.CipherValue != null)
{
private XmlDocument? _containingDocument;
private IEnumerator? _keyInfoEnum;
private X509Certificate2Collection? _x509Collection;
- private IEnumerator? _x509Enum;
+ private X509Certificate2Enumerator? _x509Enum;
private bool[]? _refProcessed;
private int[]? _refLevelCache;
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static AppleCCCryptorLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static OpenSslCipherLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
}
}
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
ArgumentNullException.ThrowIfNull(rgbKey);
return CreateCryptoTransform(rgbKey, rgbIV, encrypting: false, _outer.Padding, _outer.Mode, _outer.FeedbackSize);
}
- private ICryptoTransform CreateCryptoTransform(bool encrypting)
+ private UniversalCryptoTransform CreateCryptoTransform(bool encrypting)
{
if (KeyInPlainText)
{
return CreatePersistedLiteSymmetricCipher(ProduceCngKey, iv, encrypting, mode, feedbackSizeInBits);
}
- private ILiteSymmetricCipher CreateLiteSymmetricCipher(
+ private BasicSymmetricCipherLiteBCrypt CreateLiteSymmetricCipher(
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
bool encrypting,
return UniversalCryptoTransform.Create(padding, cipher, encrypting);
}
- private ILiteSymmetricCipher CreatePersistedLiteSymmetricCipher(
+ private BasicSymmetricCipherLiteNCrypt CreatePersistedLiteSymmetricCipher(
Func<CngKey> cngKeyFactory,
ReadOnlySpan<byte> iv,
bool encrypting,
public bool Removable { get { throw GetPlatformNotSupported(); } }
public string UniqueKeyContainerName { get { throw GetPlatformNotSupported(); } }
- private static Exception GetPlatformNotSupported()
+ private static PlatformNotSupportedException GetPlatformNotSupported()
{
return new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo)));
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of DES")]
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
ArgumentNullException.ThrowIfNull(rgbKey);
{
public partial class DSA : AsymmetricAlgorithm
{
- private static DSA CreateCore()
+ private static DSAImplementation.DSAAndroid CreateCore()
{
return new DSAImplementation.DSAAndroid();
}
{
public partial class DSA : AsymmetricAlgorithm
{
- private static DSA CreateCore()
- {
- return new DSAWrapper(new DSAOpenSsl());
- }
+ private static DSAWrapper CreateCore() => new DSAWrapper(new DSAOpenSsl());
}
}
{
public partial class DSA : AsymmetricAlgorithm
{
- private static DSA CreateCore()
+ private static DSAImplementation.DSASecurityTransforms CreateCore()
{
return new DSAImplementation.DSASecurityTransforms();
}
{
public partial class DSA : AsymmetricAlgorithm
{
- private static DSA CreateCore()
+ private static DSAWrapper CreateCore()
{
return new DSAWrapper(new DSACng());
}
[UnsupportedOSPlatform("tvos")]
public static DSA Create(DSAParameters parameters)
{
- DSA dsa = CreateCore();
+ var dsa = CreateCore();
try
{
}
}
- private static Exception DerivedClassMustOverride() =>
+ private static NotImplementedException DerivedClassMustOverride() =>
new NotImplementedException(SR.NotSupported_SubclassOverride);
public override bool TryExportEncryptedPkcs8PrivateKey(
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static OpenSslCipherLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static AppleCCCryptorLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static OpenSslCipherLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
KeyValue = key;
}
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
ArgumentNullException.ThrowIfNull(rgbKey);
public static partial ECDiffieHellman Create(ECParameters parameters)
{
- ECDiffieHellman ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid();
+ var ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid();
try
{
public static partial ECDiffieHellman Create(ECParameters parameters)
{
- ECDiffieHellman ecdh = new ECDiffieHellmanCng();
+ var ecdh = new ECDiffieHellmanCng();
try
{
public static partial ECDiffieHellman Create(ECParameters parameters)
{
- ECDiffieHellman ecdh = new ECDiffieHellmanOpenSsl();
+ var ecdh = new ECDiffieHellmanOpenSsl();
try
{
throw DerivedClassMustOverride();
}
- private static Exception DerivedClassMustOverride()
+ private static NotImplementedException DerivedClassMustOverride()
{
return new NotImplementedException(SR.NotSupported_SubclassOverride);
}
/// </param>
public static partial ECDsa Create(ECParameters parameters)
{
- ECDsa ec = new ECDsaImplementation.ECDsaAndroid();
+ var ec = new ECDsaImplementation.ECDsaAndroid();
ec.ImportParameters(parameters);
return ec;
}
/// </param>
public static partial ECDsa Create(ECParameters parameters)
{
- ECDsa ec = new ECDsaOpenSsl();
+ var ec = new ECDsaOpenSsl();
try
{
public static partial ECDsa Create(ECCurve curve)
{
return new ECDsaWrapper(new ECDsaCng(curve));
-
}
/// <summary>
/// </param>
public static partial ECDsa Create(ECParameters parameters)
{
- ECDsa ec = new ECDsaCng();
+ var ec = new ECDsaCng();
ec.ImportParameters(parameters);
return new ECDsaWrapper(ec);
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of RC2")]
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
// note: rgbIV is guaranteed to be cloned before this method, so no need to clone it again
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static AppleCCCryptorLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static OpenSslCipherLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
}
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
Key = RandomNumberGenerator.GetBytes(KeySize / BitsPerByte);
}
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
ArgumentNullException.ThrowIfNull(rgbKey);
public virtual bool VerifyHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) =>
VerifyHash(hash.ToArray(), signature.ToArray(), hashAlgorithm, padding);
- private static Exception DerivedClassMustOverride() =>
+ private static NotImplementedException DerivedClassMustOverride() =>
new NotImplementedException(SR.NotSupported_SubclassOverride);
[Obsolete(Obsoletions.RsaEncryptDecryptValueMessage, DiagnosticId = Obsoletions.RsaEncryptDecryptDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
// UseMachineKeyStore has no effect in Unix
public static bool UseMachineKeyStore { get; set; }
- private static Exception PaddingModeNotSupported()
+ private static CryptographicException PaddingModeNotSupported()
{
return new CryptographicException(SR.Cryptography_InvalidPaddingMode);
}
}
}
- private static Exception PaddingModeNotSupported()
+ private static CryptographicException PaddingModeNotSupported()
{
return new CryptographicException(SR.Cryptography_InvalidPaddingMode);
}
public partial class Rfc2898DeriveBytes
{
// Throwing UTF8 on invalid input.
- private static readonly Encoding s_throwingUtf8Encoding = new UTF8Encoding(false, true);
+ private static readonly UTF8Encoding s_throwingUtf8Encoding = new UTF8Encoding(false, true);
/// <summary>
/// Creates a PBKDF2 derived key from password bytes.
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static AppleCCCryptorLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static OpenSslCipherLite CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
}
- private static ILiteSymmetricCipher CreateLiteCipher(
+ private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
CipherMode cipherMode,
ReadOnlySpan<byte> key,
ReadOnlySpan<byte> iv,
Key = RandomNumberGenerator.GetBytes(KeySize / BitsPerByte);
}
- private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+ private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
{
ArgumentNullException.ThrowIfNull(rgbKey);
return true;
}
- private static ICertificatePal ReadPkcs12(ReadOnlySpan<byte> rawData, SafePasswordHandle password, bool ephemeralSpecified)
+ private static AndroidCertificatePal ReadPkcs12(ReadOnlySpan<byte> rawData, SafePasswordHandle password, bool ephemeralSpecified)
{
using (var reader = new AndroidPkcs12Reader(rawData))
{
_certData = new CertificateData(RawData);
}
- private ICertificatePal CopyWithPrivateKeyHandle(SafeKeyHandle privateKey)
+ private AndroidCertificatePal CopyWithPrivateKeyHandle(SafeKeyHandle privateKey)
{
// Add a global reference to the underlying cert object.
var handle = new SafeX509Handle();
}
}
- private ICertificatePal CopyWithPrivateKey(SafeSecKeyRefHandle? privateKey)
+ private AppleCertificatePal CopyWithPrivateKey(SafeSecKeyRefHandle? privateKey)
{
if (privateKey == null)
{
{
private sealed class TempExportPal : ICertificatePalCore
{
- private readonly ICertificatePal _realPal;
+ private readonly AppleCertificatePal _realPal;
internal TempExportPal(AppleCertificatePal realPal)
{
return FromBlobOrFile(ReadOnlySpan<byte>.Empty, fileName, password, keyStorageFlags);
}
- private static ICertificatePal FromBlobOrFile(ReadOnlySpan<byte> rawData, string? fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
+ private static CertificatePal FromBlobOrFile(ReadOnlySpan<byte> rawData, string? fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
{
Debug.Assert(!rawData.IsEmpty || fileName != null);
Debug.Assert(password != null);
}
}
- private unsafe ICertificatePal? CopyWithPersistedCngKey(CngKey cngKey)
+ private unsafe CertificatePal? CopyWithPersistedCngKey(CngKey cngKey)
{
if (string.IsNullOrEmpty(cngKey.KeyName))
{
return false;
}
- private unsafe ICertificatePal? CopyWithPersistedCapiKey(CspKeyContainerInfo keyContainerInfo)
+ private unsafe CertificatePal? CopyWithPersistedCapiKey(CspKeyContainerInfo keyContainerInfo)
{
if (string.IsNullOrEmpty(keyContainerInfo.KeyContainerName))
{
return pal;
}
- private ICertificatePal CopyWithEphemeralKey(CngKey cngKey)
+ private CertificatePal CopyWithEphemeralKey(CngKey cngKey)
{
Debug.Assert(string.IsNullOrEmpty(cngKey.KeyName));
{
// If no ApplicationCertPolicies extension is provided then it uses the EKU
// OIDS.
- ISet<string>? applicationCertPolicies = null;
- ISet<string>? ekus = null;
+ HashSet<string>? applicationCertPolicies = null;
+ HashSet<string>? ekus = null;
CertificatePolicy policy = new CertificatePolicy();
PolicyData policyData = cert.Pal.GetPolicyData();
policy.InhibitMappingDepth = constraints.InhibitMappingDepth;
}
- private static ISet<string> ReadExtendedKeyUsageExtension(byte[] rawData)
+ private static HashSet<string> ReadExtendedKeyUsageExtension(byte[] rawData)
{
HashSet<string> oids = new HashSet<string>();
return oids;
}
- internal static ISet<string> ReadCertPolicyExtension(byte[] rawData)
+ internal static HashSet<string> ReadCertPolicyExtension(byte[] rawData)
{
try
{
}
}
- private static IChainPal? BuildChainCore(
+ private static OpenSslX509ChainProcessor? BuildChainCore(
bool useMachineContext,
ICertificatePal cert,
X509Certificate2Collection? extraStore,
return false;
}
- ISet<string> policyOids = CertificatePolicyChain.ReadCertPolicyExtension(ext.RawData);
+ HashSet<string> policyOids = CertificatePolicyChain.ReadCertPolicyExtension(ext.RawData);
return policyOids.Contains(oidValue);
});
}
return new ECDiffieHellmanOpenSsl(_privateKey);
}
- private ICertificatePal CopyWithPrivateKey(SafeEvpPKeyHandle privateKey)
+ private OpenSslX509CertificateReader CopyWithPrivateKey(SafeEvpPKeyHandle privateKey)
{
// This could be X509Duplicate for a full clone, but since OpenSSL certificates
// are functionally immutable (unlike Windows ones) an UpRef is sufficient.
usages = oids;
}
- private static RSA BuildRsaPublicKey(byte[] encodedData)
+ private static RSAOpenSsl BuildRsaPublicKey(byte[] encodedData)
{
- RSA rsa = new RSAOpenSsl();
+ var rsa = new RSAOpenSsl();
try
{
rsa.ImportRSAPublicKey(new ReadOnlySpan<byte>(encodedData), out _);
return rsa;
}
- private static DSA BuildDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
+ private static DSAOpenSsl BuildDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
{
SubjectPublicKeyInfoAsn spki = new SubjectPublicKeyInfoAsn
{
AsnWriter writer = new AsnWriter(AsnEncodingRules.DER);
spki.Encode(writer);
- DSA dsa = new DSAOpenSsl();
+ DSAOpenSsl dsa = new DSAOpenSsl();
try
{
dsa.ImportSubjectPublicKeyInfo(writer.Encode(), out _);
new PlatformNotSupportedException(SR.Cryptography_Unix_X509_MachineStoresRootOnly));
}
- private static ILoaderPal SingleCertToLoaderPal(ICertificatePal singleCert)
- {
- return new OpenSslSingleCertLoader(singleCert);
- }
+ private static OpenSslSingleCertLoader SingleCertToLoaderPal(ICertificatePal singleCert) => new OpenSslSingleCertLoader(singleCert);
- private static ILoaderPal ListToLoaderPal(List<ICertificatePal> certPals)
- {
- return new CertCollectionLoader(certPals);
- }
+ private static CertCollectionLoader ListToLoaderPal(List<ICertificatePal> certPals) => new CertCollectionLoader(certPals);
}
}
return new AppleCertLoader(certs, null);
}
- private static ILoaderPal ImportPkcs12(
+ private static ApplePkcs12CertLoader ImportPkcs12(
ReadOnlySpan<byte> rawData,
SafePasswordHandle password,
bool exportable,
throw new CryptographicException(message, new PlatformNotSupportedException(message));
}
- private static IStorePal FromCustomKeychainStore(string storeName, OpenFlags openFlags)
+ private static AppleKeychainStore FromCustomKeychainStore(string storeName, OpenFlags openFlags)
{
string storePath;
int written = writer.Encode(rented);
DSA dsa = DSA.Create();
- IDisposable? toDispose = dsa;
+ DSA? toDispose = dsa;
try
{
{
internal sealed partial class X509Pal
{
- private static partial IX509Pal BuildSingleton()
- {
- return new OpenSslX509Encoder();
- }
+ private static partial IX509Pal BuildSingleton() => new OpenSslX509Encoder();
}
}
case AlgId.CALG_RSA_KEYX:
case AlgId.CALG_RSA_SIGN:
{
- RSA rsa = new RSABCrypt();
+ var rsa = new RSABCrypt();
rsa.ImportRSAPublicKey(encodedKeyValue, out _);
return rsa;
}
case AlgId.CALG_DSS_SIGN:
{
byte[] keyBlob = ConstructDSSPublicKeyCspBlob(encodedKeyValue, encodedParameters);
- DSACryptoServiceProvider dsa = new DSACryptoServiceProvider();
+ var dsa = new DSACryptoServiceProvider();
dsa.ImportCspBlob(keyBlob);
return dsa;
}
{
internal partial class X509Pal : IX509Pal
{
- private static partial IX509Pal BuildSingleton()
- {
- return new X509Pal();
- }
+ private static partial IX509Pal BuildSingleton() => new X509Pal();
}
}
throw new NotSupportedException(SR.NotSupported_KeyAlgorithm);
}
- private static AsymmetricAlgorithm DecodeRsaPublicKey(byte[] encodedKeyValue)
+ private static RSA DecodeRsaPublicKey(byte[] encodedKeyValue)
{
RSA rsa = RSA.Create();
try
}
}
- private static AsymmetricAlgorithm DecodeDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
+ private static DSA DecodeDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
{
SubjectPublicKeyInfoAsn spki = new SubjectPublicKeyInfoAsn
{
}
DSA dsa = DSA.Create();
- IDisposable? toDispose = dsa;
+ DSA? toDispose = dsa;
try
{
}
// This is called by AppDomain.GetThreadPrincipal() via reflection.
- private static IPrincipal GetDefaultInstance() => new WindowsPrincipal(WindowsIdentity.GetCurrent());
+ private static WindowsPrincipal GetDefaultInstance() => new WindowsPrincipal(WindowsIdentity.GetCurrent());
}
}
public XmlReader GetReader()
{
EnsureBuffer();
- XmlReader reader = _buffer.GetReader(0);
+ XmlDictionaryReader reader = _buffer.GetReader(0);
int index = 0;
reader.ReadStartElement(Rss20Constants.ExtensionWrapperTag);
while (reader.IsStartElement())
public XmlReader GetReaderAtElementExtensions()
{
XmlBuffer extensionsBuffer = GetOrCreateBufferOverExtensions();
- XmlReader reader = extensionsBuffer.GetReader(0);
+ XmlDictionaryReader reader = extensionsBuffer.GetReader(0);
reader.ReadStartElement();
return reader;
}
}
XmlBuffer newBuffer = new XmlBuffer(int.MaxValue);
- using (XmlWriter writer = newBuffer.OpenSection(XmlDictionaryReaderQuotas.Max))
+ using (XmlDictionaryWriter writer = newBuffer.OpenSection(XmlDictionaryReaderQuotas.Max))
{
writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag);
for (int i = 0; i < Count; ++i)
_stream = null;
}
- private static Exception CreateInvalidStateException() => new InvalidOperationException(SR.XmlBufferInInvalidState);
+ private static InvalidOperationException CreateInvalidStateException() => new InvalidOperationException(SR.XmlBufferInInvalidState);
public XmlDictionaryReader GetReader(int sectionIndex)
{
return ObjectToken.Open(null, tokenName, false);
}
- internal IList<ObjectToken> FindMatchingTokens(string requiredAttributes, string optionalAttributes)
+ internal List<ObjectToken> FindMatchingTokens(string requiredAttributes, string optionalAttributes)
{
- IList<ObjectToken> objectTokenList = new List<ObjectToken>();
+ var objectTokenList = new List<ObjectToken>();
ISpObjectTokenCategory category = null;
IEnumSpObjectTokens enumTokens = null;
IEnumerator<ObjectToken> IEnumerable<ObjectToken>.GetEnumerator()
{
- IList<ObjectToken> objectTokenList = FindMatchingTokens(null, null);
+ List<ObjectToken> objectTokenList = FindMatchingTokens(null, null);
foreach (ObjectToken objectToken in objectTokenList)
{
/// Download data from the web.
/// Set the redirectUri as the location of the file could be redirected in ASP pages.
/// </summary>
- private static Stream DownloadData(Uri uri, out Uri redirectedUri)
+ private static MemoryStream DownloadData(Uri uri, out Uri redirectedUri)
{
#pragma warning disable SYSLIB0014
// Create a request for the URL.
CultureInfo culture;
StringBuilder innerCode = new();
ISrgsParser srgsParser = new XmlParser(xmlReaders[iReader], uri);
- object cg = CompileStream(iReader + 1, srgsParser, srgsPath, filename, stream, fOutputCfg, innerCode, cfgResources, out culture, referencedAssemblies, keyFile);
+ CustomGrammar cg = CompileStream(iReader + 1, srgsParser, srgsPath, filename, stream, fOutputCfg, innerCode, cfgResources, out culture, referencedAssemblies, keyFile);
if (!fOutputCfg)
{
- cgCombined.Combine((CustomGrammar)cg, innerCode.ToString());
+ cgCombined.Combine(cg, innerCode.ToString());
}
}
#endregion
- private static object CompileStream(int iCfg, ISrgsParser srgsParser, string srgsPath, string filename, Stream stream, bool fOutputCfg, StringBuilder innerCode, object cfgResources, out CultureInfo culture, string[] referencedAssemblies, string keyFile)
+ private static CustomGrammar CompileStream(int iCfg, ISrgsParser srgsParser, string srgsPath, string filename, Stream stream, bool fOutputCfg, StringBuilder innerCode, object cfgResources, out CultureInfo culture, string[] referencedAssemblies, string keyFile)
{
Backend backend = new();
CustomGrammar cg = new();
private void AppendSml(XmlDocument document, int i, NumberFormatInfo nfo)
{
- XmlNode root = document.DocumentElement;
+ XmlElement root = document.DocumentElement;
XmlElement alternateNode = document.CreateElement("alternate");
root.AppendChild(alternateNode);
{
try
{
- using (TextReader reader = new StreamReader(stream))
+ using (var reader = new StreamReader(stream))
{
_text = reader.ReadToEnd();
}
Converter.ConfigureJsonTypeInfo(this, options);
}
- private static JsonConverter GetConverter(JsonObjectInfoValues<T> objectInfo)
+ private static JsonMetadataServicesConverter<T> GetConverter(JsonObjectInfoValues<T> objectInfo)
{
#pragma warning disable CS8714
// The type cannot be used as type parameter in the generic type or method.
try
{
- _ = RegexParser.ParseOptionsInPattern(argument.Value.ConstantValue.Value as string, RegexOptions.None);
+ _ = RegexParser.ParseOptionsInPattern((string)argument.Value.ConstantValue.Value!, RegexOptions.None);
}
catch (RegexParseException)
{
}
}
- private RateLimitLease CreateFailedWindowLease(int permitCount)
+ private FixedWindowLease CreateFailedWindowLease(int permitCount)
{
int replenishAmount = permitCount - _permitCount + _queueCount;
// can't have 0 replenish window, that would mean it should be a successful lease
}
}
- private RateLimitLease CreateFailedTokenLease(int tokenCount)
+ private TokenBucketLease CreateFailedTokenLease(int tokenCount)
{
int replenishAmount = tokenCount - (int)_tokenCount + _queueCount;
// can't have 0 replenish periods, that would mean it should be a successful lease
/// <summary>Whether this target is declining future messages.</summary>
private bool _decliningPermanently;
/// <summary>Input messages for the next batch.</summary>
- private IList<T> _messages = new List<T>();
+ private List<T> _messages = new List<T>();
/// <summary>Initializes the target.</summary>
/// <param name="sharedResources">The shared resources used by all targets associated with this batched join.</param>
{
Common.ContractAssertMonitorStatus(_sharedResources._incomingLock, held: true);
- IList<T> toReturn = _messages;
+ List<T> toReturn = _messages;
_messages = new List<T>();
return toReturn;
}
}
}
- private static ApplicationException GetTimeoutException()
+ private static ReaderWriterLockApplicationException GetTimeoutException()
{
return new ReaderWriterLockApplicationException(HResults.ERROR_TIMEOUT, SR.ReaderWriterLock_Timeout);
}
/// <see cref="Exception.HResult"/> value was set to ERROR_NOT_OWNER without first converting that error code into an
/// HRESULT. The same value is used here for compatibility.
/// </summary>
- private static ApplicationException GetNotOwnerException()
+ private static ReaderWriterLockApplicationException GetNotOwnerException()
{
return
new ReaderWriterLockApplicationException(
SR.ReaderWriterLock_NotOwner);
}
- private static ApplicationException GetInvalidLockCookieException()
+ private static ReaderWriterLockApplicationException GetInvalidLockCookieException()
{
return new ReaderWriterLockApplicationException(HResults.E_INVALIDARG, SR.ReaderWriterLock_InvalidLockCookie);
}
throw CreateTransactionAbortedException(tx);
}
- private static TransactionException CreateTransactionAbortedException(InternalTransaction tx)
+ private static TransactionAbortedException CreateTransactionAbortedException(InternalTransaction tx)
{
return TransactionAbortedException.Create(SR.TransactionAborted, tx._innerException, tx.DistributedTxId);
}
return true;
}
- private IEnumerable<ITaskItem> FilterOutUnmanagedAssemblies(IEnumerable<ITaskItem> assemblies)
+ private List<ITaskItem> FilterOutUnmanagedAssemblies(IEnumerable<ITaskItem> assemblies)
{
List<ITaskItem> filteredAssemblies = new();
foreach (var asmItem in assemblies)
}
}
- private static IList<ITaskItem> ConvertAssembliesDictToOrderedList(ConcurrentDictionary<string, ITaskItem> dict, IList<ITaskItem> originalAssemblies)
+ private static List<ITaskItem> ConvertAssembliesDictToOrderedList(ConcurrentDictionary<string, ITaskItem> dict, IList<ITaskItem> originalAssemblies)
{
List<ITaskItem> outItems = new(originalAssemblies.Count);
foreach (ITaskItem item in originalAssemblies)
/// Just write the dictionary out to a blob as a count followed by
/// a length-prefixed UTF8 encoding of each key and value
- private static void ConvertDictionaryToBlob(IReadOnlyDictionary<string, string> properties, BlobBuilder builder)
+ private static void ConvertDictionaryToBlob(Dictionary<string, string> properties, BlobBuilder builder)
{
int count = properties.Count;
}
}
- private bool CheckReservedProperties(IReadOnlyDictionary<string, string> properties, ITaskItem[] keys)
+ private bool CheckReservedProperties(Dictionary<string, string> properties, ITaskItem[] keys)
{
var succeed = true;
}
_totalFiles = SourceFiles.Length;
- IDictionary<string, string> envVarsDict = GetEnvironmentVariablesDict();
+ Dictionary<string, string> envVarsDict = GetEnvironmentVariablesDict();
ConcurrentBag<ITaskItem> outputItems = new();
try
{
ITaskItem CreateOutputItemFor(string srcFile, string objFile)
{
- ITaskItem newItem = new TaskItem(objFile);
+ TaskItem newItem = new TaskItem(objFile);
newItem.SetMetadata("SourceFile", srcFile);
return newItem;
}
}
}
- private IDictionary<string, string> GetEnvironmentVariablesDict()
+ private Dictionary<string, string> GetEnvironmentVariablesDict()
{
Dictionary<string, string> envVarsDict = new();
if (EnvironmentVariables == null)