Fix most violations of new CA1859 (#80335)
authorStephen Toub <stoub@microsoft.com>
Thu, 12 Jan 2023 19:58:26 +0000 (14:58 -0500)
committerGitHub <noreply@github.com>
Thu, 12 Jan 2023 19:58:26 +0000 (14:58 -0500)
* Fix most violations of new CA1859

The analyzer recommends replacing uses of types with other types that could reduce overheads (e.g. `List<T>` instead of `IList<T>`).  This fixes most of the violations we currently have of the rule, but it doesn't enable it yet because there are too many false positives; fixes for those are in-flight.  Some of these replacements won't help with perf (e.g. using `ArgumentException` instead of `Exception` as the return type of a throw helper create method), but there's little harm to them, and some of them do avoid overheads like allocation (e.g. foreach'ing something typed as `Dictionary<>` instead of `IDictionary<>` will avoid an enumerator allocation, accessing `Count` on a `List<T>` instead of `IList<T>` will avoid an interface dispatch, etc.)

* Fix mistaken replacement

237 files changed:
src/coreclr/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeCustomAttributeData.cs
src/coreclr/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
src/libraries/Common/src/Interop/Windows/BCrypt/Cng.cs
src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs
src/libraries/Microsoft.Extensions.Configuration.Json/src/JsonConfigurationFileParser.cs
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlStreamConfigurationProvider.cs
src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationRoot.cs
src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ActivatorUtilities.cs
src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/CallSiteFactory.cs
src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs
src/libraries/Microsoft.Extensions.DependencyModel/src/CompilationLibrary.cs
src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextJsonReader.cs
src/libraries/Microsoft.Extensions.DependencyModel/src/Utf8JsonReaderExtensions.cs
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Internal/Patterns/PatternBuilder.cs
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Matcher.cs
src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs
src/libraries/Microsoft.Extensions.Logging.EventLog/src/EventLogSettings.cs
src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb
src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs
src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.cs
src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/UIHintAttribute.cs
src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Validator.cs
src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/RegistrationBuilder.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/AttributedModelServices.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ConstraintServices.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ApplicationCatalog.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.ScopeManager.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CompositionServices.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/GenericSpecializationPartCreationInfo.cs
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesigntimeLicenseContextSerializer.cs
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
src/libraries/System.Composition.Convention/src/System/Composition/Convention/ConventionBuilder.cs
src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistry.cs
src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistryUpdate.cs
src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/UpdateResult.cs
src/libraries/System.Composition.TypedParts/src/System/Composition/Hosting/ContainerConfiguration.cs
src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ContractHelpers.cs
src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/Discovery/DiscoveredPart.cs
src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/TypedPartExportDescriptorProvider.cs
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Internal/WriteFileContext.cs
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/LocalFileSettingsProvider.cs
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs
src/libraries/System.Data.Common/src/System/Data/Common/DBCommandBuilder.cs
src/libraries/System.Data.Common/src/System/Data/Filter/ExpressionParser.cs
src/libraries/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs
src/libraries/System.Data.Common/src/System/Xml/XmlDataDocument.cs
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticListener.cs
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
src/libraries/System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics/TextWriterTraceListener.cs
src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/CorrelationManager.cs
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx.cs
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySchemaClass.cs
src/libraries/System.DirectoryServices/src/System/DirectoryServices/SearchResultCollection.cs
src/libraries/System.Drawing.Common/src/System/Drawing/ImageConverter.cs
src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs
src/libraries/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnCharacterStringEncodings.cs
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarFile.cs
src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.Write.cs
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/ThrowHelper.cs
src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/DelegateHelpers.cs
src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs
src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/GroupJoinQueryOperator.cs
src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Lookup.cs
src/libraries/System.Management/src/System/Management/ManagementObjectCollection.cs
src/libraries/System.Management/src/System/Management/WMIGenerator.cs
src/libraries/System.Memory/src/System/ThrowHelper.cs
src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs
src/libraries/System.Net.Http/src/System/Net/Http/Headers/MediaTypeHeaderParser.cs
src/libraries/System.Net.Http/src/System/Net/Http/Headers/TransferCodingHeaderParser.cs
src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/MultipartContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs
src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListener.Managed.cs
src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerRequest.Managed.cs
src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestStream.Windows.cs
src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpResponseStream.Windows.cs
src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/ServerWebSocket.cs
src/libraries/System.Net.Mail/src/System/Net/Base64Stream.cs
src/libraries/System.Net.Mail/src/System/Net/Mime/BaseWriter.cs
src/libraries/System.Net.Mail/src/System/Net/Mime/QEncodedStream.cs
src/libraries/System.Net.NameResolution/src/System/Net/Dns.cs
src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxIPInterfaceProperties.cs
src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPInterfaceProperties.cs
src/libraries/System.Net.Requests/src/System/Net/FileWebRequest.cs
src/libraries/System.Net.Sockets/src/System/Net/Sockets/TCPClient.cs
src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs
src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs
src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs
src/libraries/System.Private.CoreLib/src/System/DateTime.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/EventPayload.cs
src/libraries/System.Private.CoreLib/src/System/Enum.cs
src/libraries/System.Private.CoreLib/src/System/Environment.Win32.cs
src/libraries/System.Private.CoreLib/src/System/IO/File.cs
src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs
src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs
src/libraries/System.Private.CoreLib/src/System/Number.Parsing.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/CodeGenerator.cs
src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs
src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs
src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlReaderDelegator.cs
src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlWriterDelegator.cs
src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNodeReader.cs
src/libraries/System.Private.Xml.Linq/src/System/Xml/XPath/XNodeNavigator.cs
src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReaderAsync.cs
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImplAsync.cs
src/libraries/System.Private.Xml/src/System/Xml/Core/XmlWellFormedWriter.cs
src/libraries/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs
src/libraries/System.Private.Xml/src/System/Xml/Dom/DocumentSchemaValidator.cs
src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlLoader.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/XdrBuilder.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/XdrValidator.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs
src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdValidator.cs
src/libraries/System.Private.Xml/src/System/Xml/Serialization/SoapReflectionImporter.cs
src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionImporter.cs
src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSchemaExporter.cs
src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs
src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/QueryBuilder.cs
src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/XPathParser.cs
src/libraries/System.Private.Xml/src/System/Xml/XPath/XPathNavigator.cs
src/libraries/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILOptimizerVisitor.cs
src/libraries/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlIlVisitor.cs
src/libraries/System.Private.Xml/src/System/Xml/Xsl/QIL/QilValidationVisitor.cs
src/libraries/System.Private.Xml/src/System/Xml/Xsl/Xslt/QilGenerator.cs
src/libraries/System.Private.Xml/src/System/Xml/Xsl/XsltOld/XsltCompileContext.cs
src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Events/RoEvent.cs
src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Methods/RoDefinitionMethod.DllImport.cs
src/libraries/System.Resources.Extensions/src/System/Resources/Extensions/PreserializedResourceWriter.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/FuncJSGenerator.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/PrimitiveJSGenerator.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Marshaling/TaskJSGenerator.cs
src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/GeneratedStatements.cs
src/libraries/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs
src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Exceptions.cs
src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/DecryptorPalWindows.Decrypt.cs
src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/EncryptedXml.cs
src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXml.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Apple.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesImplementation.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngSymmetricAlgorithmCore.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CspKeyContainerInfo.NotSupported.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.Android.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.SecurityTransforms.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.Create.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSA.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Android.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Apple.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DesImplementation.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Android.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.Cng.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.Create.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellman.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.Android.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsa.Create.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Apple.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RC2Implementation.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Rfc2898DeriveBytes.OneShot.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Apple.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/TripleDesImplementation.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/AndroidCertificatePal.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/AppleCertificatePal.Keys.macOS.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/AppleCertificatePal.TempExportPal.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificatePal.Windows.Import.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificatePal.Windows.PrivateKey.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificatePolicy.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ManagedCertificateFinder.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509CertificateReader.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509Encoder.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.macOS.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.Android.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.OpenSsl.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.Windows.PublicKey.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.Windows.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.macOS.cs
src/libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs
src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs
src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs
src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/XmlBuffer.cs
src/libraries/System.Speech/src/Internal/ObjectToken/ObjectTokenCategory.cs
src/libraries/System.Speech/src/Internal/ResourceLoader.cs
src/libraries/System.Speech/src/Internal/SrgsCompiler/SRGSCompiler.cs
src/libraries/System.Speech/src/Result/RecognizedPhrase.cs
src/libraries/System.Speech/src/Synthesis/Prompt.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/SourceGenJsonTypeInfoOfT.cs
src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexAnalyzer.cs
src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/FixedWindowRateLimiter.cs
src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiter.cs
src/libraries/System.Threading.Tasks.Dataflow/src/Blocks/BatchedJoinBlock.cs
src/libraries/System.Threading/src/System/Threading/ReaderWriterLock.cs
src/libraries/System.Transactions.Local/src/System/Transactions/TransactionState.cs
src/tasks/AotCompilerTask/MonoAOTCompiler.cs
src/tasks/MonoTargetsTasks/RuntimeConfigParser/RuntimeConfigParser.cs
src/tasks/WasmAppBuilder/EmccCompile.cs

index 970684d6330db983297c1a2e20dee34b631de027..a2aa467d9a8c38189458ddc79904f67dbd55b369 100644 (file)
@@ -83,7 +83,7 @@ namespace System.Reflection
         [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));
index 85d06082c3f77a69e8462b1e9abbf3eebe330420..cd3eff4708cc26d2ce6c8ba03ee9b78e0956d4d7 100644 (file)
@@ -403,7 +403,7 @@ namespace System.Reflection.Emit
             throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
         }
 
-        private int GetMemberRefToken(MethodBase methodInfo, Type[]? optionalParameterTypes)
+        private int GetMemberRefToken(MethodInfo methodInfo, Type[]? optionalParameterTypes)
         {
             Type[]? parameterTypes;
             Type[][]? requiredCustomModifiers;
index bdaf23af2c9e7170045e993d0f0e68b94689efb2..329569cd0b18ab612eb3660ee09881bdf60d6eef 100644 (file)
@@ -2,6 +2,7 @@
 // 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;
@@ -92,7 +93,7 @@ namespace System.Reflection
             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);
 
index a5dedc6044b38a2034d7baf0cc2d658a61725d9a..7b55a3f341237ba327043e84f36a67178ed8437c 100644 (file)
@@ -54,7 +54,7 @@ namespace System.Runtime.Loader
         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));
index e2babde84e7c158f4616fe234b2d4a85ca81abd3..342ce64ad15ca7010d70ba9dbb6924c0ef030b5b 100644 (file)
@@ -1995,7 +1995,7 @@ namespace System
         }
 
         // Called internally
-        private static PropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
+        private static RuntimePropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
         {
             RuntimePropertyInfo property;
             RuntimePropertyInfo[] candidates =
@@ -3166,7 +3166,7 @@ namespace System
             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);
 
@@ -3182,7 +3182,7 @@ namespace System
             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);
 
@@ -3198,7 +3198,7 @@ namespace System
             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);
 
@@ -3214,7 +3214,7 @@ namespace System
             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);
 
@@ -3230,7 +3230,7 @@ namespace System
             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);
 
@@ -3246,7 +3246,7 @@ namespace System
             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);
 
index cc43b0623369b86e230d53d86e4f3187cca4d274..4c0fe5e82ad8502d6c9d8545787dfffd09b44372 100644 (file)
@@ -5,11 +5,13 @@ using System;
 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
 {
@@ -112,7 +114,7 @@ namespace Internal.NativeCrypto
             }
         }
 
-        private static Exception CreateCryptographicException(NTSTATUS ntStatus)
+        private static CryptographicException CreateCryptographicException(NTSTATUS ntStatus)
         {
             int hr = ((int)ntStatus) | 0x01000000;
             return hr.ToCryptographicException();
index 41e0ba952f0d1017011ced9a5756ecf7d1c814dd..2fbad637e81b37548f7224418783e87244da3a4c 100644 (file)
@@ -792,7 +792,7 @@ namespace System.Security.Cryptography
                 return _key.Value.DuplicateHandle();
             }
 
-            private static Exception PaddingModeNotSupported() =>
+            private static CryptographicException PaddingModeNotSupported() =>
                 new CryptographicException(SR.Cryptography_InvalidPaddingMode);
         }
     }
index c3c5edf8428eac500c39524e6a8b1edad8c6b37b..dc002fdfd59732f54712c4367d3de113e0b173af 100644 (file)
@@ -902,7 +902,7 @@ namespace System.Security.Cryptography
 
         static partial void ThrowIfNotSupported();
 
-        private static Exception PaddingModeNotSupported() =>
+        private static CryptographicException PaddingModeNotSupported() =>
             new CryptographicException(SR.Cryptography_InvalidPaddingMode);
     }
 }
index 327606bd89bb827c04137c8aded93e8719f5ddad..0d2e4e47ce73896e4866dd4f13c67b198304433c 100644 (file)
@@ -691,7 +691,7 @@ namespace Microsoft.Extensions.Configuration
                 elementType = type.GetGenericArguments()[0];
             }
 
-            IList list = new List<object?>();
+            var list = new List<object?>();
 
             if (source != null)
             {
@@ -727,7 +727,7 @@ namespace Microsoft.Extensions.Configuration
             }
 
             Array result = Array.CreateInstance(elementType, list.Count);
-            list.CopyTo(result, 0);
+            ((IList)list).CopyTo(result, 0);
             return result;
         }
 
@@ -976,7 +976,7 @@ namespace Microsoft.Extensions.Configuration
             return propertyBindingPoint.Value;
         }
 
-        private static string GetPropertyName(MemberInfo property)
+        private static string GetPropertyName(PropertyInfo property)
         {
             ThrowHelper.ThrowIfNull(property);
 
index 67251cbcdd85dfa873a990d6b48ecb6e82b8c514..fb664a8e5c4412c7bc68c86d0c30a3ba7420c8d7 100644 (file)
@@ -19,7 +19,7 @@ namespace Microsoft.Extensions.Configuration.Json
         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
             {
index 3077792922928b7e2538fa06c3794e8f8c3a39a9..e5c9b5e7d69ffb0d14dee6663d608195f2fe25c2 100644 (file)
@@ -245,7 +245,7 @@ namespace Microsoft.Extensions.Configuration.Xml
             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);
 
index 2e3455bd17f1e25513ccf36782c52aa0ffe0bada..c36c28a674313153b9cd65bdfee742c628cad7c1 100644 (file)
@@ -14,7 +14,7 @@ namespace Microsoft.Extensions.Configuration
     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>
index 0a2cb5ba943f4dfad252f6b3a09fa7bc319d7464..45b1cdc56ca5f15b3e917530c8b1158423b688ea 100644 (file)
@@ -222,7 +222,7 @@ namespace Microsoft.Extensions.DependencyInjection
             return service;
         }
 
-        private static Expression BuildFactoryExpression(
+        private static NewExpression BuildFactoryExpression(
             ConstructorInfo constructor,
             int?[] parameterMap,
             Expression serviceProvider,
index 2e8527fb5f7e21156379cf0112dff1e64029b4ca..d38d09ab3558afc83c5451274d57ba68e57c39fc 100644 (file)
@@ -398,7 +398,7 @@ namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
             return null;
         }
 
-        private ServiceCallSite CreateConstructorCallSite(
+        private ConstructorCallSite CreateConstructorCallSite(
             ResultCache lifetime,
             Type serviceType,
             [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
index af1cf5714c84e2fbd03879a1ac372144ace3bf51..c28b9f00bb4e7d86318ef7829731b625b5f74c70 100644 (file)
@@ -201,7 +201,7 @@ namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
         }
 
         // Move off the main stack
-        private Expression BuildScopedExpression(ServiceCallSite callSite)
+        private ConditionalExpression BuildScopedExpression(ServiceCallSite callSite)
         {
             ConstantExpression callSiteExpression = Expression.Constant(
                 callSite,
index 6504c362247514965bf9ce23d0bfee2e035c6864..603a08e82171904738fb9c2ae52189b355daf03a 100644 (file)
@@ -71,7 +71,7 @@ namespace Microsoft.Extensions.DependencyModel
             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))
             {
index a35f0e2a068d084fcac19d2b63193f75b87174de..e305a03de531dd016904ee5b02064458b22ddd96 100644 (file)
@@ -17,7 +17,7 @@ namespace Microsoft.Extensions.DependencyModel
         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)
         {
@@ -448,7 +448,7 @@ namespace Microsoft.Extensions.DependencyModel
             };
         }
 
-        private IEnumerable<Dependency> ReadTargetLibraryDependencies(ref Utf8JsonReader reader)
+        private List<Dependency> ReadTargetLibraryDependencies(ref Utf8JsonReader reader)
         {
             var dependencies = new List<Dependency>();
 
index 807efa2eb71a62df3c23c262779660119a4bfd21..3b7b57ed97e9dd628169ea98946e26cc03063e62 100644 (file)
@@ -132,7 +132,7 @@ namespace Microsoft.Extensions.DependencyModel
             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;
index 18ea195ceef358370630dc8e03da1d5c89ab2d7b..f7d2ff4cd4d8b7c36e147fa7d048eced763d4be7 100644 (file)
@@ -41,9 +41,9 @@ namespace Microsoft.Extensions.FileSystemGlobbing.Internal.Patterns
             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;)
index 56311ba91506acce24f5519630ae6a6febd3a219..15999f0261b9077b650b545c1b104eeafb1a3804 100644 (file)
@@ -96,8 +96,8 @@ namespace Microsoft.Extensions.FileSystemGlobbing
     /// </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;
 
index f0339b800209684a6d2ed19d3500ba666ecd3c10..33dcc552b8339fca460590c6ed3ca72d25765795 100644 (file)
@@ -125,7 +125,7 @@ namespace Microsoft.Extensions.Hosting.Internal
                 // 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())
index be072ecd14e81413b91b7b9480b8e0dbc308e816..ea5b4340f6c75ba8e39184a917d60700001014a7 100644 (file)
@@ -40,7 +40,7 @@ namespace Microsoft.Extensions.Logging.EventLog
             set => _eventLog = value;
         }
 
-        private IEventLog CreateDefaultEventLog()
+        private WindowsEventLog CreateDefaultEventLog()
         {
             string logName = string.IsNullOrEmpty(LogName) ? "Application" : LogName;
             string machineName = string.IsNullOrEmpty(MachineName) ? "." : MachineName;
index d56c7eace2a51e776228c8bb1b464cdab53e1c32..0e7efd9d7cd242e18322e3ec5718e0efd3c71312 100644 (file)
@@ -292,7 +292,7 @@ namespace Microsoft.NETCore.Platforms.BuildTasks
             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)
             {
@@ -328,7 +328,7 @@ namespace Microsoft.NETCore.Platforms.BuildTasks
             }
         }
 
-        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>>();
 
@@ -350,7 +350,7 @@ namespace Microsoft.NETCore.Platforms.BuildTasks
             }
         }
 
-        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()
             {
index aed245313bb10915a6f813513c1e60c1d8ba5947..8301ee324af3fcaef799326d12d8bc7c0c2369e1 100644 (file)
@@ -1376,7 +1376,7 @@ Namespace Microsoft.VisualBasic.CompilerServices
                             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
index 52d2bf7e5d361df866af254a65059a726124a086..b245121f4595fa6cfb9f69716589c97fd49d0dcf 100644 (file)
@@ -504,7 +504,7 @@ namespace System.Collections.Concurrent
                 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();
index 16386577856cc27923064783c73fcae3674df85a..ff0cba7fc19f436322cb73e9a06c7333134131c4 100644 (file)
@@ -235,12 +235,10 @@ namespace System.Collections.Specialized
     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
index 502ef36f373b74da3e60562c2007848488878fcc..dbb37c19009e274f5424c861bc9b4af51907f1a2 100644 (file)
@@ -159,9 +159,9 @@ namespace System.ComponentModel.DataAnnotations
             /// <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;
 
index a14599934deeae311a5e0372a34082e6196aca43..4ef742d93c85c1d1fd5947371d9c3d75cea4e951 100644 (file)
@@ -408,9 +408,7 @@ namespace System.ComponentModel.DataAnnotations
             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)
@@ -460,7 +458,7 @@ namespace System.ComponentModel.DataAnnotations
         /// <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);
@@ -515,7 +513,7 @@ namespace System.ComponentModel.DataAnnotations
         /// </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());
index 0ff56463394d10cd33b29ccfc1524edc2cc68e47..c684ababe674ebcce519bf7953e72951cf313c23 100644 (file)
@@ -98,7 +98,7 @@ namespace System.ComponentModel.Composition.Registration
             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>();
 
index 8228bfab515a4aeab801a5a568715aef665db8d5..958e8c1a6dd3c2dd97a1626712a403b10f489d1d 100644 (file)
@@ -20,8 +20,8 @@ namespace System.ComponentModel.Composition.AttributedModel
         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)
@@ -252,7 +252,7 @@ namespace System.ComponentModel.Composition.AttributedModel
             _imports = GetImportDefinitions();
         }
 
-        private IEnumerable<ExportDefinition> GetExportDefinitions()
+        private List<ExportDefinition> GetExportDefinitions()
         {
             List<ExportDefinition> exports = new List<ExportDefinition>();
 
@@ -414,7 +414,7 @@ namespace System.ComponentModel.Composition.AttributedModel
             return attributedProvider.IsAttributeDefined<InheritedExportAttribute>(false);
         }
 
-        private IEnumerable<ImportDefinition> GetImportDefinitions()
+        private List<ImportDefinition> GetImportDefinitions()
         {
             List<ImportDefinition> imports = new List<ImportDefinition>();
 
index 9b5435a94f824d34f2ef404e898a48391d1a8566..a85df971408310fe3561c64846e7b394020a66e6 100644 (file)
@@ -117,7 +117,7 @@ namespace System.ComponentModel.Composition
 
             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));
index b594bdd1002a527e4a41b473745ef2d6460651a3..c1e84849298d788affd8e7034031b9d894c4c57d 100644 (file)
@@ -53,7 +53,7 @@ namespace System.ComponentModel.Composition
             return constraint;
         }
 
-        private static Expression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
+        private static BinaryExpression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
         {
             ArgumentNullException.ThrowIfNull(parameter);
 
@@ -81,7 +81,7 @@ namespace System.ComponentModel.Composition
             return body;
         }
 
-        private static Expression CreateCreationPolicyConstraint(CreationPolicy policy, ParameterExpression parameter)
+        private static BinaryExpression CreateCreationPolicyConstraint(CreationPolicy policy, ParameterExpression parameter)
         {
             ArgumentNullException.ThrowIfNull(parameter);
 
@@ -101,7 +101,7 @@ namespace System.ComponentModel.Composition
                         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);
@@ -114,7 +114,7 @@ namespace System.ComponentModel.Composition
                         CreateMetadataValueEqualsExpression(parameter, requiredTypeIdentity, CompositionConstants.ExportTypeIdentityMetadataName));
         }
 
-        private static Expression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
+        private static MethodCallExpression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
         {
             if (parameter == null)
             {
@@ -133,7 +133,7 @@ namespace System.ComponentModel.Composition
                         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)
             {
@@ -161,7 +161,7 @@ namespace System.ComponentModel.Composition
                             );
         }
 
-        private static Expression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
+        private static MethodCallExpression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
         {
             if (parameter == null)
             {
index c012630d055ef3817b1fc07a20377b11a552657c..9d82b9ba9a494749ad18d9fabf72b2410e35f917 100644 (file)
@@ -110,10 +110,10 @@ namespace System.ComponentModel.Composition.Hosting
             {
                 if (!_isDisposed)
                 {
-                    IDisposable? innerCatalog = null;
+                    AggregateCatalog? innerCatalog = null;
                     lock (_thisLock)
                     {
-                        innerCatalog = _innerCatalog as IDisposable;
+                        innerCatalog = _innerCatalog;
                         _innerCatalog = null;
                         _isDisposed = true;
                     }
index 3fbe1d1be75278dc1845ecb90bca72cd5196e871..af045eb689db3c6721580824f3cbd73ba4382c23 100644 (file)
@@ -65,7 +65,7 @@ namespace System.ComponentModel.Composition.Hosting
                 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);
             }
index 7a0b7a78310658297d0365f2c0aedc944c24f678..7799abed0bcb885e294454f83e26df54c8a067a1 100644 (file)
@@ -308,7 +308,7 @@ namespace System.ComponentModel.Composition.Hosting
             return exports!;
         }
 
-        private IEnumerable<Export> InternalGetExportsCore(ImportDefinition definition, AtomicComposition? atomicComposition)
+        private List<Export> InternalGetExportsCore(ImportDefinition definition, AtomicComposition? atomicComposition)
         {
             ThrowIfDisposed();
             EnsureRunning();
index b0dca71756787bd098979bc204baa53297c2fb69..147371a2cc28cbeaed9e1fd185b924ca424053d5 100644 (file)
@@ -184,7 +184,7 @@ namespace System.ComponentModel.Composition.Hosting
 
         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)
             {
index f527bef17ace92009bbc5eb00df5221ae3015a07..809b53e6c1da1461ea8b425d9c658823dc12088f 100644 (file)
@@ -708,7 +708,7 @@ namespace System.ComponentModel.Composition.Hosting
             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);
 
@@ -732,7 +732,7 @@ namespace System.ComponentModel.Composition.Hosting
             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);
 
@@ -744,7 +744,7 @@ namespace System.ComponentModel.Composition.Hosting
             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);
 
@@ -787,11 +787,11 @@ namespace System.ComponentModel.Composition.Hosting
                 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);
index 778ee15f4ae997becaa056f8802890dbb288f69e..3378a19f57b807412d7069ecac9b9e3191c2ba05 100644 (file)
@@ -29,7 +29,7 @@ namespace System.ComponentModel.Composition.Hosting
         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
@@ -78,7 +78,7 @@ namespace System.ComponentModel.Composition.Hosting
             InitializeTypeCatalog(types);
 
             _definitionOrigin = this;
-            _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+            _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
         }
 
         /// <summary>
@@ -106,7 +106,7 @@ namespace System.ComponentModel.Composition.Hosting
             InitializeTypeCatalog(types);
 
             _definitionOrigin = definitionOrigin;
-            _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+            _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
         }
 
         /// <summary>
@@ -135,7 +135,7 @@ namespace System.ComponentModel.Composition.Hosting
             InitializeTypeCatalog(types, reflectionContext);
 
             _definitionOrigin = this;
-            _contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
+            _contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
         }
 
         /// <summary>
@@ -168,7 +168,7 @@ namespace System.ComponentModel.Composition.Hosting
             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)
@@ -313,7 +313,7 @@ namespace System.ComponentModel.Composition.Hosting
             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);
 
index f64d5b09f153f74e8c1aa48f630610bb89f580d3..9ff8593a44bf5e6b2be5bc0376ea149683bc7a07 100644 (file)
@@ -455,7 +455,7 @@ namespace System.ComponentModel.Composition.ReflectionModel
             }
         }
 
-        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);
 
index 951a518a2400c53a566ea9d6de7b53d3da20f21c..a4f0a09de7ce11ad6178f98506091c52c7cc9ec9 100644 (file)
@@ -42,7 +42,7 @@ namespace System.ComponentModel.Composition.ReflectionModel
             }
         }
 
-        private object CastExportsToCollectionImportType(Export[] exports)
+        private Array CastExportsToCollectionImportType(Export[] exports)
         {
             ArgumentNullException.ThrowIfNull(exports);
 
index 7fd2884af449e5afb751eaa14d443e397ae686a3..3175c9d7920207005ed1a8e30e2216920ba7bb2a 100644 (file)
@@ -52,7 +52,7 @@ namespace System.ComponentModel.Design
 
         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 });
@@ -135,7 +135,7 @@ namespace System.ComponentModel.Design
             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);
index a5caf34b9fdcff8d3a324ea31962eb37c6a0bf94..c1f0cf44e0f445191b4e90bf8edf7f1216c16e40 100644 (file)
@@ -2423,8 +2423,7 @@ namespace System.ComponentModel
         {
             ArgumentNullException.ThrowIfNull(primary);
 
-            Hashtable assocTable = AssociationTable;
-            assocTable?.Remove(primary);
+            AssociationTable?.Remove(primary);
         }
 
         /// <summary>
index 7db2e4050def9d33d233080748779d7496113611..c69ebe91e7aaa128bbb2eda7720ec8f7aad0b6fc 100644 (file)
@@ -123,7 +123,7 @@ namespace System.Composition.Convention
             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>>>();
index 4a3cc25cdbbda6501dfee12fa2a771d55edf41e9..58db525731a809d33a4b0a4e6ccd9d318fdba167 100644 (file)
@@ -10,7 +10,7 @@ namespace System.Composition.Hosting.Core
     {
         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)
         {
index 4b2fbf872084593ae163baa8c7cc4d3103fd0374..2f377263dec19d486e9f8e2879439c90515f90ae 100644 (file)
@@ -12,7 +12,7 @@ namespace System.Composition.Hosting.Core
     {
         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;
index 0be00d63fc9eb9ac7846a9e79b021a5699dc88e9..5b7acfa651cab5da780d9fb8038f46a7df6e63ec 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Composition.Hosting.Core
         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)
index b7efdca28c31dd36ac2c01614589a39201d34a5c..ea9c1d5d0e439c912aa3a5757cb6341962c86c8d 100644 (file)
@@ -20,8 +20,8 @@ namespace System.Composition.Hosting
     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
index 338c6ee039b43cab29dccd96237d40cd3d7cd855..227a3dac0bd43f80c1a54fcac338a120c989fb7b 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Composition.TypedParts
         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;
 
index 206483b25db40061e8ab4abaac6edabc17296bea..d8e9713ab571f1dc674da85f52f2c5c442215b65 100644 (file)
@@ -21,13 +21,13 @@ namespace System.Composition.TypedParts.Discovery
     {
         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;
index 7c3a276c9abab37f5180b0b6375364ce37585861..107caf16783105c257d76b49277d8e82c1d2fcf1 100644 (file)
@@ -13,7 +13,7 @@ namespace System.Composition.TypedParts
 {
     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)
         {
index 30d9cadd1f9c92a050dc46f3c3f87b3649ba8f90..cf132e4714f46a7730904c16a834a8f1215ac487 100644 (file)
@@ -203,7 +203,7 @@ namespace System.Configuration.Internal
 
         private static bool FileIsWriteLocked(string fileName)
         {
-            Stream fileStream = null;
+            FileStream fileStream = null;
 
             if (!File.Exists(fileName))
             {
index feb8b052e88ff127cf6f732b66dabae242005098..97534199e68dcf1bbdde33451016902183d32e7c 100644 (file)
@@ -433,7 +433,7 @@ namespace System.Configuration
             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));
index 55122172ea4a4c27acc1d2d2f478eda828c88ae5..a2c6d0efebbfadcf75f5ce7d5c4d8d1264f618ba 100644 (file)
@@ -2148,7 +2148,7 @@ namespace System.Configuration
         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)
index a96dd1b7b8db185fc1d37798d57be2df812df1e2..5b744965e9eb65939ab8e24d220036565bccd171 100644 (file)
@@ -647,7 +647,7 @@ namespace System.Data.Common
 
         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();
             }
index 98901f39dd3165f3ca0d8a03a68ed4ffcb54bd5a..d5daeb30ef5a453d6d79bcda2c9be7b7c1675499 100644 (file)
@@ -557,7 +557,7 @@ namespace System.Data
         ///      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 <> '('");
 
index 5e926df7f233e4fa2629189a7c24f28873dc91d6..1ec33efc1c481a2b6578b215dbb2040730332b07 100644 (file)
@@ -174,7 +174,7 @@ namespace System.Data.SqlTypes
             _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
index 9a25f941465ddb0d2d6a8a4c39df182d6feda94a..4492e1d585317f9bb5256bee4ab6b59257f04bf6 100644 (file)
@@ -864,7 +864,7 @@ namespace System.Xml
             return DataSetMapper.GetRowFromElement(e);
         }
 
-        private XmlNode? GetRowInsertBeforeLocation(DataRow row, XmlNode parentElement)
+        private XmlElement? GetRowInsertBeforeLocation(DataRow row, XmlNode parentElement)
         {
             DataRow refRow = row;
             int i;
@@ -1569,7 +1569,7 @@ namespace System.Xml
                 // 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);
index c1677307acb5e09a428fcf52085d0f9f786a555b..cc84a102ac96281bac85f5902019c8c257098cdc 100644 (file)
@@ -426,7 +426,7 @@ namespace System.Diagnostics
         }
         #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)
         {
index 73b3ed529f070aacb26d360ec5699b51e218956f..510c0d9a21e64efa13e1e21e2e367f1341828311 100644 (file)
@@ -1359,7 +1359,7 @@ namespace System.Diagnostics
 
                     [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
index e361c42a9438fb338207f87f8817bfc663af62bd..86a4fb369fd7924c4d6279cfac081d795b3e1622 100644 (file)
@@ -837,7 +837,7 @@ namespace System.Diagnostics
         /// <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));
index 4df3bc7f14dec5731a2946dad9510fbea4c9cf3f..11401e8655b340aa614f8d2e9e32a44ff3b980c9 100644 (file)
@@ -651,7 +651,7 @@ namespace System.Diagnostics
             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
index ed3a1646b74ab691cbebd7fd5cb911749c25c168..a709bb80d6a7adfcf98be3462e51620ae3315884 100644 (file)
@@ -196,16 +196,6 @@ namespace System.Diagnostics
             }
         }
 
-        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)
@@ -226,7 +216,9 @@ namespace System.Diagnostics
                 // 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
index cdb64669b093ac4837c6e94e9f87d6fce6db27f2..8619259d0011e8c7654f5f3508d9fe1e09dc6b51 100644 (file)
@@ -12,7 +12,7 @@ namespace System.Diagnostics
     {
         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()
         {
index 34f924fbf75f85a0fa1a0886e87ef926a0e9dfeb..5143dca8f0770023a3d65a480fee2c88bfdad53f 100644 (file)
@@ -1019,7 +1019,7 @@ namespace System.DirectoryServices.AccountManagement
             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);
index 90bff1b375e7aa6c57af58b52a559ca273f4ecc7..0b82943649e7a73a339925484ea5462a9f172daa 100644 (file)
@@ -572,7 +572,7 @@ namespace System.DirectoryServices.AccountManagement
             return FindByDate(FindByDateMatcher.DateProperty.AccountExpirationTime, matchType, dt, principalType);
         }
 
-        private ResultSet FindByDate(
+        private SAMQuerySet FindByDate(
                         FindByDateMatcher.DateProperty property,
                         MatchType matchType,
                         DateTime value,
index 55b972bbf8370fba48adb86dd03abe844af655cf..5cc3b6127fbb9218729adb871b855706a1a5cf6c 100644 (file)
@@ -1082,7 +1082,7 @@ namespace System.DirectoryServices.ActiveDirectory
         // 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();
index dac7ae1f9f754265eca060b0310c41abc7e7d56e..ee820b02f589c25fa96efe1d9c5d48f9f2d83c50 100644 (file)
@@ -49,7 +49,7 @@ namespace System.DirectoryServices
                 if (_innerList == null)
                 {
                     _innerList = new ArrayList();
-                    IEnumerator enumerator = new ResultsEnumerator(
+                    var enumerator = new ResultsEnumerator(
                         this,
                         _rootEntry.GetUsername(),
                         _rootEntry.GetPassword(),
index 286ccabcac9eb991807a6ac7109d4d5ddf7d07f9..66a00b47edb301253fcfaf452c2c0d8966fe142f 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Drawing
             {
                 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
@@ -107,7 +107,7 @@ namespace System.Drawing
 
         public override bool GetPropertiesSupported(ITypeDescriptorContext? context) => true;
 
-        private static unsafe Stream? GetBitmapStream(ReadOnlySpan<byte> rawData)
+        private static unsafe MemoryStream? GetBitmapStream(ReadOnlySpan<byte> rawData)
         {
             try
             {
index c387b338626ff6f3af996b94fdd030c15cb88a7a..e5c135914b8a4e94e2abd32a4d2866e384497117 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Drawing.Printing
     {
         private Graphics? _graphics;
         private DeviceContext? _dc;
-        private readonly IList _list = new ArrayList();
+        private readonly ArrayList _list = new ArrayList();
 
         public override bool IsPreview => true;
 
index 0f086e91327ff4d4941eea525a6c0e5a4d3a04b8..51206af7353724508ca001b3a7db3daa4651067a 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Drawing
         }
 
         // 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)
             {
@@ -218,7 +218,7 @@ namespace System.Drawing
             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)
             {
index 6e1309b58c16549e79c3387fcfe758ab7d5ebba5..64b8f3d7ef0987b0c96a225654cc4e2e84979811 100644 (file)
@@ -11,15 +11,13 @@ namespace System.Formats.Asn1
 {
     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
@@ -419,7 +417,7 @@ namespace System.Formats.Asn1
     /// </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)
index e784598cefb3a0684bd8595d98146b09e4e8e308..040f689c1be45151f5af86c2fbfd4f0494c8d7d5 100644 (file)
@@ -405,7 +405,7 @@ namespace System.Formats.Tar
 
         // 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,
index 40b0e330b314b4dd802dc2b562432f85a3a64c83..41be887ed38912daa4411b7a07edd76f92753ee8 100644 (file)
@@ -643,7 +643,7 @@ namespace System.Formats.Tar
         }
 
         // 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;
 
index b20a90297f268cf39ccde8b7218fe84a6ec34a40..5cbfc5710603bbfd9dba4832e52c03e3c890e602 100644 (file)
@@ -687,7 +687,7 @@ namespace System.IO.Compression
             return GetDataDecompressor(compressedStream);
         }
 
-        private Stream OpenInWriteMode()
+        private WrappedStream OpenInWriteMode()
         {
             if (_everOpenedForWrite)
                 throw new IOException(SR.CreateModeWriteOnceAndOneEntryAtATime);
@@ -708,7 +708,7 @@ namespace System.IO.Compression
             return new WrappedStream(baseStream: _outstandingWriteStream, closeBaseStream: true);
         }
 
-        private Stream OpenInUpdateMode()
+        private WrappedStream OpenInUpdateMode()
         {
             if (_currentlyOpenForWrite)
                 throw new IOException(SR.UpdateModeOneStream);
index fd6f30551408dc3cc08af8773b5d54d0387a1a81..2c49129705d1f9b26ed855b3c12554e891f7410c 100644 (file)
@@ -147,7 +147,7 @@ namespace System.IO.MemoryMappedFiles
 #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);
         }
index ec4faf3072277874826efd4d89718369ed94983a..f769e23e5e8a8feddb2c48e2d9ba39c23c5c33c7 100644 (file)
@@ -11,83 +11,83 @@ namespace System.IO.Pipelines
         [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
index af9f48f4be648ef2c897094842ec1f02a9bb34f9..651c1811938d3ec3dbbd154efbb05d54f674daed 100644 (file)
@@ -107,7 +107,7 @@ namespace System.Linq.Expressions.Compiler
             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)
             {
index 1060396627d0fafbfae8e12ebb22b7b83803928a..f1869bda25cc84ab057d7e0e056ee3f0edc4ec21 100644 (file)
@@ -14,189 +14,189 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -204,7 +204,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -212,7 +212,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -220,7 +220,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -228,287 +228,287 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -516,98 +516,98 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -615,28 +615,28 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -644,63 +644,63 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -708,98 +708,98 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -807,7 +807,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -815,42 +815,42 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -858,7 +858,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -866,35 +866,35 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -902,21 +902,21 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -924,147 +924,147 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1073,21 +1073,21 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1095,7 +1095,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1103,70 +1103,70 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1174,14 +1174,14 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1190,7 +1190,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1199,7 +1199,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1207,7 +1207,7 @@ namespace System.Linq.Expressions
         /// <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();
         }
@@ -1215,7 +1215,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1223,7 +1223,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1231,7 +1231,7 @@ namespace System.Linq.Expressions
         /// <summary>
         /// InvalidProgramException with default message.
         /// </summary>
-        internal static Exception InvalidProgram()
+        internal static InvalidProgramException InvalidProgram()
         {
             return new InvalidProgramException();
         }
@@ -1239,7 +1239,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1247,7 +1247,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1255,7 +1255,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1263,7 +1263,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1271,7 +1271,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1279,7 +1279,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1287,7 +1287,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1295,7 +1295,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1303,7 +1303,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1311,7 +1311,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1319,7 +1319,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1327,7 +1327,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1335,7 +1335,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1344,7 +1344,7 @@ namespace System.Linq.Expressions
         /// <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));
         }
@@ -1352,7 +1352,7 @@ namespace System.Linq.Expressions
         /// <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);
         }
@@ -1360,27 +1360,27 @@ namespace System.Linq.Expressions
         /// <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);
         }
index f2323f2d7ea78a9cb4400f8e97d72d8f8d1ee17c..077f5f8a061d958454f5ef6ebbf36c61576f6c08 100644 (file)
@@ -155,12 +155,12 @@ namespace System.Linq.Parallel
             }
         }
 
-        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);
         }
index 60fbccd67517333bb4436bfef31d42e4c48d5e69..62b8042f138ff3d36f5d61020b3ab7083b6ceb03 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Linq.Parallel
     /// <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;
 
index 6cf4db5423cb8893697700337e7d303e7f1c18a8..b6006925a02c5ca7c64c123748153ac6f82177e3 100644 (file)
@@ -144,7 +144,7 @@ namespace System.Management
                 //
                 int count = 0;
 
-                IEnumerator enumCol = this.GetEnumerator();
+                ManagementObjectEnumerator enumCol = this.GetEnumerator();
                 while (enumCol.MoveNext())
                 {
                     count++;
index ce0e1ad51c90ced3e615f2e88af326e46e61b00f..396a2bc303f2871bcc98a8c46f1858650be56510 100644 (file)
@@ -64,7 +64,7 @@ namespace System.Management
 
         private ManagementClass classobj;
         private CodeDomProvider cp;
-        private TextWriter tw;
+        private StreamWriter tw;
         private readonly string genFileName = string.Empty;
         private CodeTypeDeclaration cc;
         private CodeTypeDeclaration ccc;
@@ -926,7 +926,7 @@ namespace System.Management
         /// <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;
@@ -950,7 +950,7 @@ namespace System.Management
 
             if (isLiteral)
             {
-                cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(propValue.ToString())));
+                cmp.GetStatements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(propValue)));
             }
             else
             {
index 4d48db89f4fe9e4d2b9fbe469c329176b9ad7e84..2fe5031e55a9a3e496d41b789b0b04f6cff18b75 100644 (file)
@@ -27,32 +27,32 @@ namespace System
         [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
@@ -96,7 +96,7 @@ namespace System
         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);
index d1b624d06260eae0f5e2e3ab1adbee8723c3b55f..389174a5258afbfdff467f5d193528c82dd68368 100644 (file)
@@ -107,12 +107,10 @@ namespace System.Net.Http.Headers
         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
index e8d6e5c15a33aa17a66b1f554845598f061f53c3..20d1a87f3ec0d526c09797eb4e2aba611630fcc4 100644 (file)
@@ -29,14 +29,8 @@ namespace System.Net.Http.Headers
             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();
     }
 }
index 6d87ed5096a29f64ce9da1554f034f93ac2679eb..63287f0bdb158026ce5b43369ab2047e93383345 100644 (file)
@@ -37,14 +37,8 @@ namespace System.Net.Http.Headers
             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();
     }
 }
index 227cb6b5f48f3cb21d7d7fa78f1276c2c63ec226..4fa0beb89d483c342869c88f34697613320f983d 100644 (file)
@@ -624,7 +624,7 @@ namespace System.Net.Http
             return true;
         }
 
-        private MemoryStream? CreateMemoryStream(long maxBufferSize, out Exception? error)
+        private LimitMemoryStream? CreateMemoryStream(long maxBufferSize, out Exception? error)
         {
             error = null;
 
@@ -832,7 +832,7 @@ namespace System.Net.Http
             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));
         }
index 1e9ce91f2edf0a5067ef83dcb3eec3a9cbc2b799..eb7893ab458dd0ee7cfef3126dd48bd6139fdc00 100644 (file)
@@ -346,12 +346,12 @@ namespace System.Net.Http
             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);
index a3f49ffc55255e63f940e928991ae0081641020b..431105b9eb7a97235158635d597009b9db1f3624 100644 (file)
@@ -569,7 +569,7 @@ namespace System.Net.Http
                 return Task.FromCanceled<HttpResponseMessage>(cancellationToken);
             }
 
-            HttpMessageHandler handler = _handler ?? SetupHandlerChain();
+            HttpMessageHandlerStage handler = _handler ?? SetupHandlerChain();
 
             Exception? error = ValidateAndNormalizeRequest(request);
             if (error != null)
index 892d41c63c4a4c0ab0786108116418b02c3fe3bd..3f84bed71529eba3ffd2a73e88ec604243ccf48a 100644 (file)
@@ -15,7 +15,7 @@ namespace System.Net
     // 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;
index a202354e77e3e7d3b695ea9469b8db3768890464..1927cf273fe62a652754ebd3f95e5867d7f3f7ea 100644 (file)
@@ -217,7 +217,7 @@ namespace System.Net
                 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();
@@ -227,7 +227,7 @@ namespace System.Net
 
                 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();
index 4d911b5488e68c5337a16b29ee2a18518c64ae5f..3fd532b8883109be3079a0480d6a74861b5a7ffe 100644 (file)
@@ -363,7 +363,7 @@ namespace System.Net
 
         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);
 
index fbdeb8f50f4dfb44aee47072caf1795364221638..bde01dd39c8e27d79d9eda0941dcf018486bed45 100644 (file)
@@ -93,7 +93,7 @@ namespace System.Net
                 }
                 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;
                 }
@@ -199,9 +199,8 @@ namespace System.Net
                     }
                     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;
                     }
                 }
index 37eabcd78cf49dab8345c3b32c7997e87901e018..e2aa84705b3f793b7dbc67c89350c7763619cbb1 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Net
 
             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();
@@ -146,7 +146,7 @@ namespace System.Net
             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))
@@ -213,7 +213,7 @@ namespace System.Net
                 }
                 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();
@@ -356,9 +356,8 @@ namespace System.Net
             }
             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;
             }
index 8913f5e4be24918896b23c4d74fc5827aaceeb60..48e8da4f1ae1c9b1c29ee8fd40c9aab111f6ac1b 100644 (file)
@@ -66,7 +66,7 @@ namespace System.Net.WebSockets
             }
         }
 
-        private SafeHandle CreateWebSocketHandle()
+        private SafeWebSocketHandle CreateWebSocketHandle()
         {
             Debug.Assert(_properties != null, "'_properties' MUST NOT be NULL.");
             return WebSocketProtocolComponent.WebSocketCreateServerHandle(
index 337539e8e6f130e0825590b21e46bb19b1d7ad60..0b2e934dee69e3f6ea94190dcb667e28fc55b5fa 100644 (file)
@@ -33,7 +33,7 @@ namespace System.Net
 
         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;
index 7f323aa335e14e38b00b11f2426e10a65e7a8eb8..d54af7a50bb5507464b292ce9e143236b366391f 100644 (file)
@@ -99,7 +99,7 @@ namespace System.Net.Mime
 
         internal Stream GetContentStream() => GetContentStream(null);
 
-        private Stream GetContentStream(MultiAsyncResult? multiResult)
+        private ClosableStream GetContentStream(MultiAsyncResult? multiResult)
         {
             if (_isInContent)
             {
index dc851f6e7d4a7d99a9bc35b51692f03788fd19c5..8bce045ce26733e5ef8a0ce28310a6cd4957156a 100644 (file)
@@ -39,7 +39,7 @@ namespace System.Net.Mime
 
         private ReadStateInfo? _readState;
         private readonly WriteStateInfoBase _writeState;
-        private readonly IByteEncoder _encoder;
+        private readonly QEncoder _encoder;
 
         internal QEncodedStream(WriteStateInfoBase wsi) : base(new MemoryStream())
         {
index b6f073d028263b0096bc5818d65e4e727205d076..cf049dab3c51c08772adb0ffb6643c9b6fdfee96 100644 (file)
@@ -712,11 +712,7 @@ namespace System.Net
             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 };
     }
 }
index 0e18a9b87842a5c7f1ce8a151e5aeccff18a0203..6930f757dc6ef49c453ef97a9af27f88b40417a0 100644 (file)
@@ -11,8 +11,8 @@ namespace System.Net.NetworkInformation
     {
         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;
 
@@ -70,7 +70,7 @@ namespace System.Net.NetworkInformation
             return new GatewayIPAddressInformationCollection(collection);
         }
 
-        private IPAddressCollection GetDhcpServerAddresses()
+        private InternalIPAddressCollection GetDhcpServerAddresses()
         {
             List<IPAddress> internalCollection = new List<IPAddress>();
 
@@ -81,7 +81,7 @@ namespace System.Net.NetworkInformation
             return new InternalIPAddressCollection(internalCollection);
         }
 
-        private static IPAddressCollection GetWinsServerAddresses()
+        private static InternalIPAddressCollection GetWinsServerAddresses()
         {
             List<IPAddress> internalCollection
                 = StringParsingHelpers.ParseWinsServerAddressesFromSmbConfFile(NetworkFiles.SmbConfFile);
index 725f60bfd6dfb9d77d30e36a8f968d68e18a48cd..0077f065311695278836fb3cedff1706ec003c4a 100644 (file)
@@ -108,7 +108,7 @@ namespace System.Net.NetworkInformation
             }
         }
 
-        private static IPAddressCollection? GetDnsAddresses()
+        private static InternalIPAddressCollection? GetDnsAddresses()
         {
             try
             {
index 48af79dbf9716199b5bdb9b96f61d7d3f1c28fae..7550bf4a5c10c8dc2ce76b726e707ad458825fa2 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Net
         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;
@@ -110,7 +110,7 @@ namespace System.Net
 
         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()
@@ -141,7 +141,7 @@ namespace System.Net
             }
         }
 
-        private Stream CreateWriteStream()
+        private WebFileStream CreateWriteStream()
         {
             try
             {
@@ -159,7 +159,7 @@ namespace System.Net
         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);
         }
@@ -167,7 +167,7 @@ namespace System.Net
         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();
index 83b10b0878248aa176c0ad119f734f01afbcd07d..4d60b197f7a932eabaa37d08d75f4b93f0561f43 100644 (file)
@@ -256,7 +256,7 @@ namespace System.Net.Sockets
             {
                 if (disposing)
                 {
-                    IDisposable? dataStream = _dataStream;
+                    NetworkStream? dataStream = _dataStream;
                     if (dataStream != null)
                     {
                         dataStream.Dispose();
index b23317fdc22b8e86b1a5565ca190ffd021ce62bf..ac1c9e295b8858114f1ecff79353d14cc3915f95 100644 (file)
@@ -941,7 +941,7 @@ namespace System.Net
         }
 
         private byte[] UploadBits(
-            WebRequest request, Stream? readStream, byte[] buffer, int chunkSize,
+            WebRequest request, FileStream? readStream, byte[] buffer, int chunkSize,
             byte[]? header, byte[]? footer)
         {
             try
@@ -1002,7 +1002,7 @@ namespace System.Net
         }
 
         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)
         {
index 8f8b46154fac839b9000c692e0026e5eaf86fb83..48a55b462c1c04697594ef8af8e74ed5667d8f31 100644 (file)
@@ -1535,7 +1535,7 @@ namespace System.Net.WebSockets
         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,
index cd85eb01ff7015b9718da06dcb489f49dfdb2830..b876ef34dcf7661c8109b3ee07165ac423ef8015 100644 (file)
@@ -112,7 +112,7 @@ namespace System
                                                            object?[]? activationAttributes,
                                                            ref StackCrawlMark stackMark)
         {
-            Assembly assembly;
+            RuntimeAssembly assembly;
             if (assemblyString == null)
             {
                 assembly = Assembly.GetExecutingAssembly(ref stackMark);
index db1b270d2ddff4a9a0e4a742961e802251311bf4..0f56dbaaeb58f722e1657f1498c36b1d4b98417f 100644 (file)
@@ -1931,7 +1931,7 @@ namespace System
         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;
 
index f839d0e9bf65a5502f001e82f788916e3e5a8170..c543affb70a5302d5bb544a0a6c6241fbe22ff28 100644 (file)
@@ -6061,7 +6061,7 @@ namespace System.Diagnostics.Tracing
 #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.
index 15a4d6e6fd04b5309d54b519f372f7fdc16e3bb3..93ecdb8ceb1f2ddad88765004d2ac1cfffbfff65 100644 (file)
@@ -90,11 +90,7 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        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)
         {
index 992448c3304439b323018504afb65455c6575f00..75a7709b10b108767e1a5920979c816dd27ba150 100644 (file)
@@ -2248,19 +2248,17 @@ namespace System
 
         [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() =>
index 2250e152894c4d15d281ad16193e220cda2e5c85..10f7815ab0af6c18c7bf0ddda366cc76d76efbee 100644 (file)
@@ -63,7 +63,7 @@ namespace System
             }
         }
 
-        private static IDictionary GetEnvironmentVariablesFromRegistry(bool fromMachine)
+        private static Hashtable GetEnvironmentVariablesFromRegistry(bool fromMachine)
         {
             var results = new Hashtable();
 
index 48e53e0c7af912b309832de9c3436b2763983ef0..e512103a3237624b6bb397aa0e5b7be18f9bbd89 100644 (file)
@@ -758,7 +758,7 @@ namespace System.IO
             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);
@@ -1069,7 +1069,7 @@ namespace System.IO
                 : 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);
index d07f668f3eca0d5c8355c8b4401dd0515dd26db7..a7e5befbb4c25dfa9690135e715ed48948b17f31 100644 (file)
@@ -212,7 +212,7 @@ namespace System.IO
         {
         }
 
-        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);
@@ -225,7 +225,7 @@ namespace System.IO
             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);
index 60b752bf2b56d3987aee5c86b52a7e60822ab00d..5583c2c7f33961c253528cea6617c1fd6a247d6d 100644 (file)
@@ -159,7 +159,7 @@ namespace System.IO
         {
         }
 
-        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);
@@ -172,7 +172,7 @@ namespace System.IO
             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);
index a9bb8ec61bd68dd29bd6d81678182f3b07b67eb6..b738f5058d08a91989d17836d01a8a21c32334e7 100644 (file)
@@ -2736,7 +2736,7 @@ namespace System
             return GetOverflowException(type);
         }
 
-        private static Exception GetOverflowException(TypeCode type)
+        private static OverflowException GetOverflowException(TypeCode type)
         {
             string s;
             switch (type)
@@ -2773,21 +2773,15 @@ namespace System
             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)
         {
index 65689f7ab1ef4add941e9a3e148ab73795e528aa..050f54448dd155bf77daf8edb3140c48c35fed28 100644 (file)
@@ -123,12 +123,12 @@ namespace System.Resources
 
         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.
index 8e023db7db8aa0c6698bb77765c97746d04f352c..07dc497bb6e4556e3105c705721c90cdd52b961b 100644 (file)
@@ -4393,7 +4393,7 @@ namespace System.Threading.Tasks
             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)
index ba6d73260b3697fbb57325e0698774ea677c0c61..45de843e4e1caff685a9f8c446b6b76d0dbfe7cc 100644 (file)
@@ -1110,7 +1110,7 @@ namespace System.Runtime.Serialization
             }
         }
 
-        private void LoadParam(object? arg, int oneBasedArgIndex, MethodBase methodInfo)
+        private void LoadParam(object? arg, int oneBasedArgIndex, MethodInfo methodInfo)
         {
             Load(arg);
             if (arg != null)
index 9c1a2a245d9e2329ca800f0c43f6590ec8d83aa5..91c27033d102ca5b50ef2952c06a8ce9403a4e23 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Runtime.Serialization.Json
         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)
         {
index 385307dc237cdf35ba14e315724367caa5a81fd7..a8d81fb96dcca72d7c288d30423d1f5548372cde 100644 (file)
@@ -890,7 +890,7 @@ namespace System.Runtime.Serialization
             return dataNode;
         }
 
-        private IDataNode ReadUnknownXmlData(XmlReaderDelegator xmlReader, string? dataContractName, string? dataContractNamespace)
+        private XmlDataNode ReadUnknownXmlData(XmlReaderDelegator xmlReader, string? dataContractName, string? dataContractNamespace)
         {
             XmlDataNode dataNode = new XmlDataNode()
             {
@@ -901,8 +901,8 @@ namespace System.Runtime.Serialization
             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)
@@ -948,7 +948,7 @@ namespace System.Runtime.Serialization
             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>();
index 597b48e63ac14b2829e7fbf1082c514b667945bd..147fca02494fbb9a3ce2bcc5b91957a02dba2b83 100644 (file)
@@ -206,7 +206,7 @@ namespace System.Runtime.Serialization
                 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,
index 9873c19c40abb121bab0fa53c7f3c854e60abf59..2682d2ab60d5ef63cb5aa28adb0cd9b264fa4d11 100644 (file)
@@ -269,7 +269,7 @@ namespace System.Runtime.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)));
         }
index ddbf41d82b8b455dad938c20fb56ac32e1cb070c..8b012e7d3a2b16acfdae74a9ea1256cc3d19e676 100644 (file)
@@ -1068,9 +1068,9 @@ namespace System.Xml.Linq
             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);
index ea7d1f28ddfa4727c23d2d8149a008d6450871f7..de86a3abaf022dea8b6a460950b3048dea39713e 100644 (file)
@@ -735,9 +735,9 @@ namespace System.Xml.XPath
             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);
index 5b9838dbb47bb8c55e6c7e040889b8e8ad97a0dc..6521a3ad0927296bb94391a3270869e2e0119a24 100644 (file)
@@ -306,7 +306,7 @@ namespace System.Xml
         // 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;
 
@@ -1050,7 +1050,7 @@ namespace System.Xml
                                 break;
 
                             default:
-                                throw ThrowNotSupported(SR.XmlBinary_ListsOfValuesNotSupported);
+                                throw CreateNotSupportedException(SR.XmlBinary_ListsOfValuesNotSupported);
                         }
                     }
                 }
@@ -1812,8 +1812,7 @@ namespace System.Xml
             if (ScanState.XmlText == _state)
             {
                 Debug.Assert(_textXmlReader != null);
-                IXmlNamespaceResolver resolver = (IXmlNamespaceResolver)_textXmlReader;
-                return resolver.GetNamespacesInScope(scope);
+                return _textXmlReader.GetNamespacesInScope(scope);
             }
             else
             {
@@ -1853,8 +1852,7 @@ namespace System.Xml
             if (ScanState.XmlText == _state)
             {
                 Debug.Assert(_textXmlReader != null);
-                IXmlNamespaceResolver resolver = (IXmlNamespaceResolver)_textXmlReader;
-                return resolver.LookupPrefix(namespaceName);
+                return _textXmlReader.LookupPrefix(namespaceName);
             }
             else
             {
@@ -1886,7 +1884,7 @@ namespace System.Xml
         {
             if (_version < requiredVersion)
             {
-                throw ThrowUnexpectedToken(token);
+                throw CreateUnexpectedTokenException(token);
             }
         }
 
@@ -2056,7 +2054,7 @@ namespace System.Xml
             while (FillAllowEOF() && ((_pos + require) >= _end))
                 ;
             if ((_pos + require) >= _end)
-                throw ThrowXmlException(SR.Xml_UnexpectedEOF1);
+                throw CreateXmlException(SR.Xml_UnexpectedEOF1);
         }
 
         // inline the common case
@@ -2114,7 +2112,7 @@ namespace System.Xml
                         // 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);
                     }
                 }
@@ -2151,7 +2149,7 @@ namespace System.Xml
                             // 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);
                         }
                     }
@@ -2638,7 +2636,7 @@ namespace System.Xml
                     }
                     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;
@@ -2650,7 +2648,7 @@ namespace System.Xml
                     // 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
@@ -2945,7 +2943,7 @@ namespace System.Xml
                     return true;
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
 
             return true;
@@ -3021,7 +3019,7 @@ namespace System.Xml
                 case BinXmlToken.XSD_UNSIGNEDINT:
                 case BinXmlToken.XSD_UNSIGNEDLONG:
                 case BinXmlToken.XSD_QNAME:
-                    throw ThrowNotSupported(SR.XmlBinary_ListsOfValuesNotSupported);
+                    throw CreateNotSupportedException(SR.XmlBinary_ListsOfValuesNotSupported);
                 default:
                     break;
             }
@@ -3041,7 +3039,7 @@ namespace System.Xml
                         _docState = 3;
                         break;
                     case -1:
-                        throw ThrowUnexpectedToken(_token);
+                        throw CreateUnexpectedTokenException(_token);
                     default:
                         break;
                 }
@@ -3101,7 +3099,7 @@ namespace System.Xml
         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;
@@ -3113,7 +3111,7 @@ namespace System.Xml
         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)
             {
@@ -3121,9 +3119,9 @@ namespace System.Xml
                 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();
@@ -3265,7 +3263,7 @@ namespace System.Xml
                 case 3:
                     break;
                 default:
-                    throw ThrowXmlException(SR.Xml_InvalidRootData);
+                    throw CreateXmlException(SR.Xml_InvalidRootData);
             }
         }
 
@@ -3327,7 +3325,7 @@ namespace System.Xml
             Type? t = s_tokenTypeMap[(int)token];
 
             if (t == null)
-                throw ThrowUnexpectedToken(token);
+                throw CreateUnexpectedTokenException(token);
 
             return t;
         }
@@ -3481,7 +3479,7 @@ namespace System.Xml
                         break;
 
                     default:
-                        throw ThrowUnexpectedToken(token);
+                        throw CreateUnexpectedTokenException(token);
                 }
             }
             Fill(-1);
@@ -3530,7 +3528,7 @@ namespace System.Xml
                 {
                     if (!BinaryPrimitives.TryReadUInt16LittleEndian(data, out ushort lowSurr))
                     {
-                        throw ThrowXmlException(SR.Xml_InvalidSurrogateMissingLowChar);
+                        throw CreateXmlException(SR.Xml_InvalidSurrogateMissingLowChar);
                     }
                     if (!XmlCharType.IsLowSurrogate((char)lowSurr))
                     {
@@ -3572,7 +3570,7 @@ namespace System.Xml
         private void CheckValueTokenBounds()
         {
             if ((_end - _tokDataPos) < _tokLen)
-                throw ThrowXmlException(SR.Xml_UnexpectedEOF1);
+                throw CreateXmlException(SR.Xml_UnexpectedEOF1);
         }
 
         private int GetXsdKatmaiTokenLength(BinXmlToken token)
@@ -3597,7 +3595,7 @@ namespace System.Xml
                     scale = _data[_pos];
                     return 6 + XsdKatmaiTimeScaleToValueLength(scale);
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3667,7 +3665,7 @@ namespace System.Xml
                     }
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3680,7 +3678,7 @@ namespace System.Xml
             }
             else
             {
-                throw ThrowUnexpectedToken(_token);
+                throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3728,7 +3726,7 @@ namespace System.Xml
                     }
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3764,7 +3762,7 @@ namespace System.Xml
                     return (double)ValueAsDecimal();
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3828,7 +3826,7 @@ namespace System.Xml
                     return BinXmlDateTime.XsdKatmaiTimeOffsetToDateTime(_data, _tokDataPos);
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -3840,7 +3838,7 @@ namespace System.Xml
                 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),
             };
         }
 
@@ -3905,7 +3903,7 @@ namespace System.Xml
                     return BinXmlDateTime.XsdKatmaiTimeOffsetToString(_data, _tokDataPos);
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -4026,7 +4024,7 @@ namespace System.Xml
                         }
 
                     default:
-                        throw ThrowUnexpectedToken(_token);
+                        throw CreateUnexpectedTokenException(_token);
                 }
             }
             catch
@@ -4172,7 +4170,7 @@ namespace System.Xml
                     }
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
         }
 
@@ -4373,7 +4371,7 @@ namespace System.Xml
                     }
 
                 default:
-                    throw ThrowUnexpectedToken(_token);
+                    throw CreateUnexpectedTokenException(_token);
             }
             return value;
         }
@@ -4394,25 +4392,25 @@ namespace System.Xml
 
         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);
index b3b025e18bfbc9a7bb265553043dce63c0831fc8..81814a540e1429c560be7725b833f04a135e181c 100644 (file)
@@ -1186,7 +1186,7 @@ namespace System.Xml
         }
 
         // Writes the attribute into the provided XmlWriter.
-        private void WriteAttributeValue(XmlWriter xtw)
+        private void WriteAttributeValue(XmlTextWriter xtw)
         {
             string attrName = Name;
             while (ReadAttributeValue())
index 7339f7f496b46833129b5754365bf4ffe8795c91..82f448f0133b3ab905abaf8085aacaf527cb1e50 100644 (file)
@@ -395,7 +395,7 @@ namespace System.Xml
             return true;
         }
 
-        private Task FinishReadElementContentAsXxxAsync()
+        private Task<bool> FinishReadElementContentAsXxxAsync()
         {
             if (NodeType != XmlNodeType.EndElement)
             {
index f7b904d4eac802fbc98409d91ac5ccbf754d946e..79ea7cb0feea7ba00169a11443a2d653d05363e3 100644 (file)
@@ -934,12 +934,12 @@ namespace System.Xml
             _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);
index ad7903433b7c4829d1c2c3bfe7cbe683f8a5483e..c6c64a92b35ff98f5b130166c5647938595c52a6 100644 (file)
@@ -2072,7 +2072,7 @@ namespace System.Xml
             }
         }
 
-        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];
index 4d13eb3d52633f383181527cfb55f585b482dab5..408f48cf1c12a90257e0f24fdf8ee9a65908d977 100644 (file)
@@ -135,7 +135,7 @@ namespace System.Xml
                 _manageNamespaces = true;
             }
 
-            _thisNSResolver = this as IXmlNamespaceResolver;
+            _thisNSResolver = this;
             _xmlResolver = xmlResolver;
             _processInlineSchema = (readerSettings.ValidationFlags & XmlSchemaValidationFlags.ProcessInlineSchema) != 0;
 
index 3392ff393ed0b0cf32c6a9cad878768412c8e8b8..c167773889538c16302a7bf8a11604913c0a4997 100644 (file)
@@ -473,7 +473,7 @@ namespace System.Xml
             return defaultPrefix;
         }
 
-        private object? GetNodeValue()
+        private string? GetNodeValue()
         {
             return _currentNode!.Value;
         }
index f139daac0eca9837f2f364d15432d43a07ea5fbd..cfa576bc0df1d61c77f049805b42abbd94381c1d 100644 (file)
@@ -925,7 +925,7 @@ namespace System.Xml
 
 #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)
index 00e56f9e32464edc26328ef6daa5177591afe415..fcdc286fbd7ba741517e35edd8f143962a050e7a 100644 (file)
@@ -1246,7 +1246,7 @@ namespace System.Xml.Schema
             }
 
             // 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;
index f683cd5e35136b83858ff0ef38345326f482f096..d2d01d4c5616e070d3e70d38fdaab0684f1edaef 100644 (file)
@@ -1764,7 +1764,7 @@ namespace System.Xml.Schema
     {
         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)
         {
@@ -3242,7 +3242,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3306,7 +3306,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3363,7 +3363,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3419,7 +3419,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3507,7 +3507,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3563,7 +3563,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3619,7 +3619,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
@@ -3674,7 +3674,7 @@ namespace System.Xml.Schema
     {
         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; } }
 
index c0b5726f7378c07ac01e68d5463d2e9261dc68bc..e37bbe1715e3ffecad5e71c4abeb14cd7d72e2ac 100644 (file)
@@ -517,7 +517,7 @@ namespace System.Xml.Schema
             }
             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));
index f5419f97e5ba629f011a501271ab982e14162ee9..e201be1218a49b8c353c6095c207ec108270b372 100644 (file)
@@ -337,7 +337,7 @@ namespace System.Xml.Schema
                 return;
             }
             string url = uri.Substring(x_schema.Length);
-            XmlReader? reader = null;
+            XmlTextReader? reader = null;
             SchemaInfo? xdrSchema = null;
             try
             {
index 66756e9913627e8728174255c7e63ab6d91b5f1a..d29b355c889e1060d2418e60630296efce89d686 100644 (file)
@@ -3122,7 +3122,7 @@ namespace System.Xml.Schema
         /// 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));
index 391d9fe7338abac05a0e895f3eaa4f6eec85555e..4025b2c9c0429e14af1a4490bcd9df06e9f6b86a 100644 (file)
@@ -569,7 +569,7 @@ namespace System.Xml.Schema
 
         private void LoadSchemaFromLocation(string uri, string url)
         {
-            XmlReader? reader = null;
+            XmlTextReader? reader = null;
             SchemaInfo? schemaInfo = null;
 
             try
index 9199edf0ccd291099e07483f65ebfa6d6e40d86d..a4f5aab5fbc3ca165ead2b7d48f0bb5429c39d2a 100644 (file)
@@ -134,7 +134,7 @@ namespace System.Xml.Serialization
             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);
         }
index c65a4db922b5af3728c8be224bfbaff57ff69b4a..1a6cb23c883fd0bd3625a7789414f3b322793bc9 100644 (file)
@@ -358,17 +358,17 @@ namespace System.Xml.Serialization
                 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);
         }
@@ -604,12 +604,12 @@ namespace System.Xml.Serialization
                 _ => 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)));
         }
index 682c0112cf3412383606c68fb13041233904911e..a05f5a56fb092e69cb3027fafdc43a59db1992f3 100644 (file)
@@ -538,7 +538,7 @@ namespace System.Xml.Serialization
             }
         }
 
-        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);
@@ -551,7 +551,7 @@ namespace System.Xml.Serialization
             return type;
         }
 
-        private XmlSchemaType ExportAnonymousPrimitiveMapping(PrimitiveMapping mapping)
+        private XmlSchemaSimpleType ExportAnonymousPrimitiveMapping(PrimitiveMapping mapping)
         {
             if (mapping is EnumMapping)
             {
@@ -1138,7 +1138,7 @@ namespace System.Xml.Serialization
             }
         }
 
-        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];
index 74d7ae560fcceb18962e394b55c92933799ac084..93f538f840503213011bb189ab023aabdb7a864f 100644 (file)
@@ -1548,7 +1548,7 @@ namespace System.Xml.Serialization
         }
 
         [RequiresUnreferencedCode("calls GetArrayElementType")]
-        private object? ReadArray(string? typeName, string? typeNs)
+        private Array? ReadArray(string? typeName, string? typeNs)
         {
             SoapArrayInfo arrayInfo;
             Type? fallbackElementType = null;
index a38aad8a80ae4de356b5099f5ac0780c6e1463b2..f98014d00e61ca23c1e3d4d9331bc37e5ae0ae71 100644 (file)
@@ -336,7 +336,7 @@ namespace MS.Internal.Xml.XPath
             }
         }
 
-        private Query ProcessVariable(Variable root)
+        private VariableQuery ProcessVariable(Variable root)
         {
             _needContext = true;
             if (!_allowVar)
index cad844bf45885fd495dd751075ac741e1b619630..0605cc8c426d4a90cc50c6c7fc287811ef553e2e 100644 (file)
@@ -394,7 +394,7 @@ namespace MS.Internal.Xml.XPath
         }
 
         //>> 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;
 
@@ -499,7 +499,7 @@ namespace MS.Internal.Xml.XPath
             return opnd;
         }
 
-        private AstNode ParseMethod(AstNode? qyInput)
+        private Function ParseMethod(AstNode? qyInput)
         {
             List<AstNode> argList = new List<AstNode>();
             string name = _scanner.Name;
@@ -650,7 +650,7 @@ namespace MS.Internal.Xml.XPath
         }
 
         //>> IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')'
-        private AstNode? ParseIdKeyPattern()
+        private Function? ParseIdKeyPattern()
         {
             Debug.Assert(_scanner.CanBeFunction);
             List<AstNode> argList = new List<AstNode>();
index 80fa5d24688fe72babab7b8553a23c53229608ec..6f96b802e36e38de04768fd5fbff80cc3b33e68a 100644 (file)
@@ -1291,7 +1291,7 @@ namespace System.Xml.XPath
 
         public virtual void ReplaceSelf(string newNode)
         {
-            XmlReader reader = CreateContextReader(newNode, false);
+            XmlTextReader reader = CreateContextReader(newNode, false);
             ReplaceSelf(reader);
         }
 
@@ -1787,7 +1787,7 @@ namespace System.Xml.XPath
             }
         }
 
-        private static XPathExpression CompileMatchPattern(string xpath)
+        private static CompiledXpathExpr CompileMatchPattern(string xpath)
         {
             bool hasPrefix;
             Query query = new QueryBuilder().BuildPatternQuery(xpath, out hasPrefix);
@@ -1986,12 +1986,12 @@ namespace System.Xml.XPath
             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);
 
index cafa183a445ce397d5d38619b6a884da76fe5a04..fe9685301082358f563715a0dbd1793cdbbafe25 100644 (file)
@@ -5620,7 +5620,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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;
 
index 109b254dcdb76b571cd1564a09682da0dae58062..cb08abc2c69b4ed8d54d979123be5d278d75ebeb 100644 (file)
@@ -1270,7 +1270,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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;
@@ -1378,7 +1378,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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!;
@@ -1477,7 +1477,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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);
@@ -2916,7 +2916,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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;
@@ -3098,7 +3098,7 @@ namespace System.Xml.Xsl.IlGen
         /// <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);
index e23d6afe46862b7634e095f6313013427a185f2d..c8e608bab5804c3d1eac4315b8492959846e88f7 100644 (file)
@@ -40,9 +40,9 @@ namespace System.Xml.Xsl.Qil
         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();
 
 
         //-----------------------------------------------
index c55df0af32c2f8f49aadbfcf865beb30658e829c..cf6898aeed4aed2ff5f8b2baec7f240a3ef789bd 100644 (file)
@@ -1516,7 +1516,7 @@ namespace System.Xml.Xsl.Xslt
 
         // 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();
 
index c99b115fc32d531cca27794dd7b9a9816998576a..8d4131627a578c326ddb7480784c85b3433afaf1 100644 (file)
@@ -184,7 +184,7 @@ namespace System.Xml.Xsl.XsltOld
         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);
index 946a11a5e50f70e7831255981ecfb74339ea737c..8d47a942fb997f7d1ec090a61bd0a436d91563ab 100644 (file)
@@ -54,9 +54,9 @@ namespace System.Reflection.TypeLoading
         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);
index 655dd1085bebbb176c179295c388cec64d1503d8..48908c0786223c96b919de31d69ae1e884b36b79 100644 (file)
@@ -11,7 +11,7 @@ namespace System.Reflection.TypeLoading
     /// </summary>
     internal sealed partial class RoDefinitionMethod<TMethodDecoder>
     {
-        private CustomAttributeData? ComputeDllImportCustomAttributeDataIfAny()
+        private RoPseudoCustomAttributeData? ComputeDllImportCustomAttributeDataIfAny()
         {
             if ((Attributes & MethodAttributes.PinvokeImpl) == 0)
                 return null;
index 150b1183af657fec9280569004fc3187ee852557..6940943d5dc7c3b66346ad8b414e44f613d12174 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Resources.Extensions
         // 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) },
index 896fb07011201f841f787ddc0780fbc7761b4dce..7fbc4dd6ae9c846da0a60961fa4e5dc77b53cc88 100644 (file)
@@ -190,7 +190,7 @@ namespace Microsoft.Interop.JavaScript
                 IdentifierName(Constants.ArgumentReturn), IdentifierName("Initialize")))));
         }
 
-        private StatementSyntax InvokeSyntax()
+        private ExpressionStatementSyntax InvokeSyntax()
         {
             return ExpressionStatement(InvocationExpression(
                 MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(Constants.JSFunctionSignatureGlobal), IdentifierName("InvokeJS")))
index 771e6b8e7ebbe491f005555ebe782a89b45c0d29..be4773e77f5abeb64958a835c9a093299a17b4f0 100644 (file)
@@ -79,7 +79,7 @@ namespace Microsoft.Interop.JavaScript
             }
         }
 
-        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)));
@@ -101,7 +101,7 @@ namespace Microsoft.Interop.JavaScript
                 .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);
index 021f9e79459b0f15f0e714c56554034973640c0b..d3de4818346979bb6273041ecdba2735a517fcc8 100644 (file)
@@ -68,14 +68,14 @@ namespace Microsoft.Interop.JavaScript
             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)))
index 780615ead0065bb9cb85d04c34a08b4c70948693..a88b755cff4e687a7a958e9f8c63f83a14ee2dc2 100644 (file)
@@ -79,21 +79,21 @@ namespace Microsoft.Interop.JavaScript
             }
         }
 
-        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)))
@@ -116,7 +116,7 @@ namespace Microsoft.Interop.JavaScript
                         }))))))))}))));
         }
 
-        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)))
index 459fff2cb589ac8750802e8fdc08869efc8fe664..b0b14372adec307a7bed07bf44889009f78f4041 100644 (file)
@@ -167,7 +167,7 @@ namespace Microsoft.Interop
             return new SyntaxTokenList(strippedTokens);
         }
 
-        private static MemberDeclarationSyntax PrintGeneratedSource(
+        private static MethodDeclarationSyntax PrintGeneratedSource(
             ContainingSyntax userDeclaredMethod,
             SignatureContext stub,
             BlockSyntax stubCode)
index 16b469a6c91e5cccb4333f9c59c9221599e302f7..e399f1330578033d01aba4fe4754cdad8049d991 100644 (file)
@@ -88,7 +88,7 @@ namespace Microsoft.Interop
             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)
             {
@@ -116,7 +116,7 @@ namespace Microsoft.Interop
         }
 
 
-        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)
             {
index a4441b8a31803a4ffc13641ca23bb1f9a5e7f270..d5f37c5a6efc38d565b3079748cc3534bfdb7868 100644 (file)
@@ -83,6 +83,6 @@ namespace System.Security.Principal
         }
 
         // 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 });
     }
 }
index 076910d0167d9512dfc7df7455b6e2e1b4b85be3..53a723f932976ebe61078f5bc4cb10c85f635e5b 100644 (file)
@@ -28,7 +28,7 @@ namespace Internal.Cryptography.Pal.AnyOS
             return CreateInvalidMessageTypeException();
         }
 
-        private static Exception CreateInvalidMessageTypeException()
+        private static CryptographicException CreateInvalidMessageTypeException()
         {
             // Windows CRYPT_E_INVALID_MSG_TYPE
             return new CryptographicException(SR.Cryptography_Cms_InvalidMessageType);
index 5201952164e0dc4532123cb6665bbebdffe0065a..8e9848075f76a91c30cd9dc33b8aff056793d8f9 100644 (file)
@@ -119,7 +119,7 @@ namespace Internal.Cryptography.Pal.Windows
             }
         }
 
-        private static Exception? TryGetKeySpecForCertificate(X509Certificate2 cert, out CryptKeySpec keySpec)
+        private static CryptographicException? TryGetKeySpecForCertificate(X509Certificate2 cert, out CryptKeySpec keySpec)
         {
             using (SafeCertContextHandle hCertContext = cert.CreateCertContextHandle())
             {
@@ -162,7 +162,7 @@ namespace Internal.Cryptography.Pal.Windows
             }
         }
 
-        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);
 
@@ -257,7 +257,7 @@ namespace Internal.Cryptography.Pal.Windows
             }
         }
 
-        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))
             {
index 1b769ebe3f687b0b829b30c41fe333a2e00e52bb..b056d70dc0dfb93c972cd413766acdd218fe7e85 100644 (file)
@@ -181,7 +181,7 @@ namespace System.Security.Cryptography.Xml
                 throw new ArgumentNullException(nameof(cipherData));
             }
 
-            Stream? inputStream = null;
+            MemoryStream? inputStream = null;
 
             if (cipherData.CipherValue != null)
             {
index 0a3a3510cb8ca333ce3e41b2e8c0057a63b4b38b..8dba99350986c5b3b97c604e558eb1738a32f691 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Security.Cryptography.Xml
         private XmlDocument? _containingDocument;
         private IEnumerator? _keyInfoEnum;
         private X509Certificate2Collection? _x509Collection;
-        private IEnumerator? _x509Enum;
+        private X509Certificate2Enumerator? _x509Enum;
 
         private bool[]? _refProcessed;
         private int[]? _refLevelCache;
index f4b595ca0839b39c8d10ea122c704e07d41c6364..95eba3d9e4dd0ee4dabac4c82a92ae8925c58e8d 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static AppleCCCryptorLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 31da3fcba44a398fc3aacfba2443889383a896c5..084e6353e7336b5d9a3c52136a0b13160dccf348 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static OpenSslCipherLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 8035dd909997197a39983348c8b42a82939ac836..14479487b78d60e512c48562ee3b16c6ae48bab9 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index c29586373a773098378422b26ea41b0ad59164b2..c3ea366cc2b35cff2628bb058afa35a9cc52dc28 100644 (file)
@@ -178,7 +178,7 @@ namespace System.Security.Cryptography
             }
         }
 
-        private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+        private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
         {
             ArgumentNullException.ThrowIfNull(rgbKey);
 
index ded5b10aa7c85343de334410763bfb5249d8cd64..0dbaba6f92223380cf9f0d8adae5798a31366e92 100644 (file)
@@ -116,7 +116,7 @@ namespace System.Security.Cryptography
             return CreateCryptoTransform(rgbKey, rgbIV, encrypting: false, _outer.Padding, _outer.Mode, _outer.FeedbackSize);
         }
 
-        private ICryptoTransform CreateCryptoTransform(bool encrypting)
+        private UniversalCryptoTransform CreateCryptoTransform(bool encrypting)
         {
             if (KeyInPlainText)
             {
@@ -136,7 +136,7 @@ namespace System.Security.Cryptography
             return CreatePersistedLiteSymmetricCipher(ProduceCngKey, iv, encrypting, mode, feedbackSizeInBits);
         }
 
-        private ILiteSymmetricCipher CreateLiteSymmetricCipher(
+        private BasicSymmetricCipherLiteBCrypt CreateLiteSymmetricCipher(
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
             bool encrypting,
@@ -206,7 +206,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(padding, cipher, encrypting);
         }
 
-        private ILiteSymmetricCipher CreatePersistedLiteSymmetricCipher(
+        private BasicSymmetricCipherLiteNCrypt CreatePersistedLiteSymmetricCipher(
             Func<CngKey> cngKeyFactory,
             ReadOnlySpan<byte> iv,
             bool encrypting,
index 553634120b657fd889e85fcd1957b6bf493111ec..dafd749cf6c5a720f48096fcdef2145c04ae3680 100644 (file)
@@ -22,7 +22,7 @@ namespace System.Security.Cryptography
         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)));
         }
index 2639b28a2b5c7ddfe625673d2d44eafadf30d9a1..53daec248e08946891cf74c48baa280f39a7150b 100644 (file)
@@ -60,7 +60,7 @@ namespace System.Security.Cryptography
         }
 
         [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);
 
index b4d76655dcbe7bc86699648c1eb52022183c9179..d98d9ecc40b83835b73343be2059a388304ec1ac 100644 (file)
@@ -5,7 +5,7 @@ namespace System.Security.Cryptography
 {
     public partial class DSA : AsymmetricAlgorithm
     {
-        private static DSA CreateCore()
+        private static DSAImplementation.DSAAndroid CreateCore()
         {
             return new DSAImplementation.DSAAndroid();
         }
index 3b4c8b052ab8a85ea6fbfd2e4843879fd5c41b7d..18a3c0936e53f058f89ddce5fe57439edf9726b4 100644 (file)
@@ -5,9 +5,6 @@ namespace System.Security.Cryptography
 {
     public partial class DSA : AsymmetricAlgorithm
     {
-        private static DSA CreateCore()
-        {
-            return new DSAWrapper(new DSAOpenSsl());
-        }
+        private static DSAWrapper CreateCore() => new DSAWrapper(new DSAOpenSsl());
     }
 }
index 3ce3230b5368dd254c8ae34333ad7a71ae15e1bd..26ede00c6d18654847dbc38d34bb97f1fc350295 100644 (file)
@@ -5,7 +5,7 @@ namespace System.Security.Cryptography
 {
     public partial class DSA : AsymmetricAlgorithm
     {
-        private static DSA CreateCore()
+        private static DSAImplementation.DSASecurityTransforms CreateCore()
         {
             return new DSAImplementation.DSASecurityTransforms();
         }
index fa667bb92ca333f2d99202f59c9e6b2bb59a96d6..5da1de27039cdc7b9847004fa672a2356451313c 100644 (file)
@@ -5,7 +5,7 @@ namespace System.Security.Cryptography
 {
     public partial class DSA : AsymmetricAlgorithm
     {
-        private static DSA CreateCore()
+        private static DSAWrapper CreateCore()
         {
             return new DSAWrapper(new DSACng());
         }
index b1331334dc8a4e03dc4fd8ab931b4f347284f581..58c30a5aca959d6f3da99c787ef1f3146c73767a 100644 (file)
@@ -66,7 +66,7 @@ namespace System.Security.Cryptography
         [UnsupportedOSPlatform("tvos")]
         public static DSA Create(DSAParameters parameters)
         {
-            DSA dsa = CreateCore();
+            var dsa = CreateCore();
 
             try
             {
@@ -905,7 +905,7 @@ namespace System.Security.Cryptography
             }
         }
 
-        private static Exception DerivedClassMustOverride() =>
+        private static NotImplementedException DerivedClassMustOverride() =>
             new NotImplementedException(SR.NotSupported_SubclassOverride);
 
         public override bool TryExportEncryptedPkcs8PrivateKey(
index b4819f3f5522b63ca4881f4e7cd1797755e768ef..a894557415908d0f048c29d600893790f14c0132 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static OpenSslCipherLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 3cafbbcb6900f71354794b819bb50fda43b611a8..84b6cd85b07990a1e8a87bc25a88bd4683a639f4 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static AppleCCCryptorLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 758fb3d6f922d29e3bdbceefb7040ab02fac0186..9e6ea895d590c3bd752009581b0b14e2cef44e37 100644 (file)
@@ -26,7 +26,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static OpenSslCipherLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 8baad301e69819e6b47ea2491e5047c175622628..e86b4d965ef51e5d961c8a19b51046d187588a35 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index f420ee410597fdc9e7d90f0892d9f0c84904affd..e42d6a394d025f75f9afc1a6b19b54965566b91f 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Security.Cryptography
             KeyValue = key;
         }
 
-        private ICryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
+        private UniversalCryptoTransform CreateTransform(byte[] rgbKey, byte[]? rgbIV, bool encrypting)
         {
             ArgumentNullException.ThrowIfNull(rgbKey);
 
index ffc16ab1e68ea7e7117c5f28e072a1e3dc4cdd8b..2c0bc61d40438056de378ca828a4eba3a2ffdce0 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Security.Cryptography
 
         public static partial ECDiffieHellman Create(ECParameters parameters)
         {
-            ECDiffieHellman ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid();
+            var ecdh = new ECDiffieHellmanImplementation.ECDiffieHellmanAndroid();
 
             try
             {
index 48eb815bd5ee973608b83cf744205fba90198de5..6b2ee8da58859341c505b8567417d1736670f058 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Security.Cryptography
 
         public static partial ECDiffieHellman Create(ECParameters parameters)
         {
-            ECDiffieHellman ecdh = new ECDiffieHellmanCng();
+            var ecdh = new ECDiffieHellmanCng();
 
             try
             {
index da2747f534277a550e5b3d0b5f81cf0cfdd59782..7b515f21edab3b0f56480d17e7af7a6f123feef1 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Security.Cryptography
 
         public static partial ECDiffieHellman Create(ECParameters parameters)
         {
-            ECDiffieHellman ecdh = new ECDiffieHellmanOpenSsl();
+            var ecdh = new ECDiffieHellmanOpenSsl();
 
             try
             {
index 9eaf8d78c920d42546ada69588575312144e34d4..a94fe8395d829fc0ea687e70899b972b479138e7 100644 (file)
@@ -133,7 +133,7 @@ namespace System.Security.Cryptography
             throw DerivedClassMustOverride();
         }
 
-        private static Exception DerivedClassMustOverride()
+        private static NotImplementedException DerivedClassMustOverride()
         {
             return new NotImplementedException(SR.NotSupported_SubclassOverride);
         }
index db65ef6abfa9bc150e7fe1c059cbf4e8be7840c6..eaa773c1e3e21ed5ab945291fbe855b5edf69c60 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Security.Cryptography
         /// </param>
         public static partial ECDsa Create(ECParameters parameters)
         {
-            ECDsa ec = new ECDsaImplementation.ECDsaAndroid();
+            var ec = new ECDsaImplementation.ECDsaAndroid();
             ec.ImportParameters(parameters);
             return ec;
         }
index 850fbf9766b14b52644e5d163c25567f2883c96a..6b6d8089f3854b5c43357bd4f15d35e8fe4ccbc0 100644 (file)
@@ -32,7 +32,7 @@ namespace System.Security.Cryptography
         /// </param>
         public static partial ECDsa Create(ECParameters parameters)
         {
-            ECDsa ec = new ECDsaOpenSsl();
+            var ec = new ECDsaOpenSsl();
 
             try
             {
index 3794ff6be455bd5effac483992c395dc271b580c..761b0c3eae9d22cd4dea70aeb32b1722cdc7a755 100644 (file)
@@ -22,7 +22,6 @@ namespace System.Security.Cryptography
         public static partial ECDsa Create(ECCurve curve)
         {
             return new ECDsaWrapper(new ECDsaCng(curve));
-
         }
 
         /// <summary>
@@ -33,7 +32,7 @@ namespace System.Security.Cryptography
         /// </param>
         public static partial ECDsa Create(ECParameters parameters)
         {
-            ECDsa ec = new ECDsaCng();
+            var ec = new ECDsaCng();
             ec.ImportParameters(parameters);
             return new ECDsaWrapper(ec);
         }
index c7e0cc4003d714ecddb6b753ada27f3a4dbd4deb..c80b8ba31bb3b1408d34fad8c90238edfca1ec23 100644 (file)
@@ -78,7 +78,7 @@ namespace System.Security.Cryptography
         }
 
         [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
 
index 0e75ecddeb62d4f0f6424a2dea7b3f14ad2d8dfb..5ff071a57c5c5fe76cf2b4985b951e4a20883a22 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static AppleCCCryptorLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 31307edc02a4f44fee39288d6e921f2589959b59..c1416513e2c1df649f330bd2210f7f60ef474f5a 100644 (file)
@@ -26,7 +26,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static OpenSslCipherLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 4fa83de798608cc369e8761157c77388fc5242cf..bb16e4004c705fd5f620945156f0962095edba94 100644 (file)
@@ -26,7 +26,7 @@ namespace System.Security.Cryptography
             }
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 4d7a33595aebacc2d4daaa7cd1295e0c798f766c..f785edeedb03fdbc42524ef3b891ebc7d6d85daf 100644 (file)
@@ -54,7 +54,7 @@ namespace System.Security.Cryptography
             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);
 
index 375c1f2b1cf9dca4581032f4dae372a7ad7ee9d5..735fe64c3092b2ef5ce214ec1ed38c8696d7fc1c 100644 (file)
@@ -329,7 +329,7 @@ namespace System.Security.Cryptography
         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)]
index 8cb55d97b6aabeee9daad68cbe513ff2a12cf02b..e6977e2e67e83ffdb158ba9be7fa9b530ffd72e3 100644 (file)
@@ -316,7 +316,7 @@ namespace System.Security.Cryptography
         // 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);
         }
index b327866789cbd8bf6859a8105d058b60deb58b01..53d88f8818c261c3aff7a1c49836b958bf2afe31 100644 (file)
@@ -674,7 +674,7 @@ namespace System.Security.Cryptography
             }
         }
 
-        private static Exception PaddingModeNotSupported()
+        private static CryptographicException PaddingModeNotSupported()
         {
             return new CryptographicException(SR.Cryptography_InvalidPaddingMode);
         }
index c4643a56921e5d5e62601b41a729ea82678ead88..88ca89094e3da0dc52e1c12ae7ffde1738d9768f 100644 (file)
@@ -10,7 +10,7 @@ namespace System.Security.Cryptography
     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.
index 47177257828ff4d02bf4307c4aff76b40e8ff31d..e7c9668036ed5d52540769b63fae57bf14b4b05f 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static AppleCCCryptorLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 5bcdd5298be2de5540945adf9937472b85f9046e..c2c0655d029ae2516ebe07e50832caba22763632 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static OpenSslCipherLite CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 2b274702cd7b6e637174df4f181487e515929d43..145444989c93178a02d1c016556f05f6b40aee28 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Security.Cryptography
             return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
         }
 
-        private static ILiteSymmetricCipher CreateLiteCipher(
+        private static BasicSymmetricCipherLiteBCrypt CreateLiteCipher(
             CipherMode cipherMode,
             ReadOnlySpan<byte> key,
             ReadOnlySpan<byte> iv,
index 67c5cd7d5cc82e9149d7d45f4829275fffeddda4..7708ff71482a6f0560f908a89d23eb2964f88720 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Security.Cryptography
             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);
 
index 8a06450fac91c357a7e4abe754ef8ba7bf666bfb..986351f9b997ea3cf7d76e6bbb0fea34caf5c0bf 100644 (file)
@@ -109,7 +109,7 @@ namespace System.Security.Cryptography.X509Certificates
             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))
             {
@@ -522,7 +522,7 @@ namespace System.Security.Cryptography.X509Certificates
             _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();
index 49107777cd5badfb71c8c12c6e87294d9640b180..d926074d88c4896649a0a44ed4d45cb8b12cbd38 100644 (file)
@@ -139,7 +139,7 @@ namespace System.Security.Cryptography.X509Certificates
             }
         }
 
-        private ICertificatePal CopyWithPrivateKey(SafeSecKeyRefHandle? privateKey)
+        private AppleCertificatePal CopyWithPrivateKey(SafeSecKeyRefHandle? privateKey)
         {
             if (privateKey == null)
             {
index 035dde20c5f0880d07950282f08b4bed6eb60548..134f92405ecb44d35fb9d65d7a6abd52d37ec65e 100644 (file)
@@ -11,7 +11,7 @@ namespace System.Security.Cryptography.X509Certificates
     {
         private sealed class TempExportPal : ICertificatePalCore
         {
-            private readonly ICertificatePal _realPal;
+            private readonly AppleCertificatePal _realPal;
 
             internal TempExportPal(AppleCertificatePal realPal)
             {
index 904d84b8c6c63b8cbf0ed2bb2bd9029f86ad1382..72cc24c4f0ca71d7110f7f0e84f7e841f7072e6e 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Security.Cryptography.X509Certificates
             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);
index 96e4d2b957943fce4c2820c09697140c883d3508..e80641afc1818b2502d02ce5fcb3834c90db1ea7 100644 (file)
@@ -353,7 +353,7 @@ namespace System.Security.Cryptography.X509Certificates
             }
         }
 
-        private unsafe ICertificatePal? CopyWithPersistedCngKey(CngKey cngKey)
+        private unsafe CertificatePal? CopyWithPersistedCngKey(CngKey cngKey)
         {
             if (string.IsNullOrEmpty(cngKey.KeyName))
             {
@@ -550,7 +550,7 @@ namespace System.Security.Cryptography.X509Certificates
             return false;
         }
 
-        private unsafe ICertificatePal? CopyWithPersistedCapiKey(CspKeyContainerInfo keyContainerInfo)
+        private unsafe CertificatePal? CopyWithPersistedCapiKey(CspKeyContainerInfo keyContainerInfo)
         {
             if (string.IsNullOrEmpty(keyContainerInfo.KeyContainerName))
             {
@@ -585,7 +585,7 @@ namespace System.Security.Cryptography.X509Certificates
             return pal;
         }
 
-        private ICertificatePal CopyWithEphemeralKey(CngKey cngKey)
+        private CertificatePal CopyWithEphemeralKey(CngKey cngKey)
         {
             Debug.Assert(string.IsNullOrEmpty(cngKey.KeyName));
 
index db1a0ae21dd437132205b9214855234362ea6dac..b4aa38f70f79774cf8276b46ab13d0455059232e 100644 (file)
@@ -227,8 +227,8 @@ namespace System.Security.Cryptography.X509Certificates
         {
             // 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();
@@ -311,7 +311,7 @@ namespace System.Security.Cryptography.X509Certificates
             policy.InhibitMappingDepth = constraints.InhibitMappingDepth;
         }
 
-        private static ISet<string> ReadExtendedKeyUsageExtension(byte[] rawData)
+        private static HashSet<string> ReadExtendedKeyUsageExtension(byte[] rawData)
         {
             HashSet<string> oids = new HashSet<string>();
 
@@ -335,7 +335,7 @@ namespace System.Security.Cryptography.X509Certificates
             return oids;
         }
 
-        internal static ISet<string> ReadCertPolicyExtension(byte[] rawData)
+        internal static HashSet<string> ReadCertPolicyExtension(byte[] rawData)
         {
             try
             {
index e45e3d938b996edeb49a42d909674b550393d379..e3a40e86f345aa8b3ad50e5019ae24cea9aeed3b 100644 (file)
@@ -71,7 +71,7 @@ namespace System.Security.Cryptography.X509Certificates
             }
         }
 
-        private static IChainPal? BuildChainCore(
+        private static OpenSslX509ChainProcessor? BuildChainCore(
             bool useMachineContext,
             ICertificatePal cert,
             X509Certificate2Collection? extraStore,
index a37d25159df6ce8579538d6e98ece1b3d583ae5c..94ed04d7ee2896d2a45472251664aa82abf23854 100644 (file)
@@ -235,7 +235,7 @@ namespace System.Security.Cryptography.X509Certificates
                         return false;
                     }
 
-                    ISet<string> policyOids = CertificatePolicyChain.ReadCertPolicyExtension(ext.RawData);
+                    HashSet<string> policyOids = CertificatePolicyChain.ReadCertPolicyExtension(ext.RawData);
                     return policyOids.Contains(oidValue);
                 });
         }
index 60591aea1ba8d52bac0172e2a2e9e62e817e2275..f06a243b577b293b62d9dbf0d91caaf04b2b71f8 100644 (file)
@@ -606,7 +606,7 @@ namespace System.Security.Cryptography.X509Certificates
             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.
index a25546c7a44e22e7d3b25df76352d868f0cd083c..529861fee448dbe4d254c7c225fb2e6879ecc440 100644 (file)
@@ -261,9 +261,9 @@ namespace System.Security.Cryptography.X509Certificates
             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 _);
@@ -276,7 +276,7 @@ namespace System.Security.Cryptography.X509Certificates
             return rsa;
         }
 
-        private static DSA BuildDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
+        private static DSAOpenSsl BuildDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
         {
             SubjectPublicKeyInfoAsn spki = new SubjectPublicKeyInfoAsn
             {
@@ -287,7 +287,7 @@ namespace System.Security.Cryptography.X509Certificates
             AsnWriter writer = new AsnWriter(AsnEncodingRules.DER);
             spki.Encode(writer);
 
-            DSA dsa = new DSAOpenSsl();
+            DSAOpenSsl dsa = new DSAOpenSsl();
             try
             {
                 dsa.ImportSubjectPublicKeyInfo(writer.Encode(), out _);
index 34b9a97dd2f4e11611c9bd898655c052dfae5d94..efd7568cec166065416832dde9887c77c632bef0 100644 (file)
@@ -179,14 +179,8 @@ namespace System.Security.Cryptography.X509Certificates
                 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);
     }
 }
index 5587d6330e5cdc24d3cbb316c85ae7c7c8860a45..503372210d2ed8f6b3e9a049173d80e4a07df8ce 100644 (file)
@@ -59,7 +59,7 @@ namespace System.Security.Cryptography.X509Certificates
             return new AppleCertLoader(certs, null);
         }
 
-        private static ILoaderPal ImportPkcs12(
+        private static ApplePkcs12CertLoader ImportPkcs12(
             ReadOnlySpan<byte> rawData,
             SafePasswordHandle password,
             bool exportable,
@@ -135,7 +135,7 @@ namespace System.Security.Cryptography.X509Certificates
             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;
 
index 16270d39ddcb3fbf22d493144a441639fe1d77de..c1bb2793803a4b3cd3a3867bc00c8f9093898180 100644 (file)
@@ -160,7 +160,7 @@ namespace System.Security.Cryptography.X509Certificates
                 int written = writer.Encode(rented);
 
                 DSA dsa = DSA.Create();
-                IDisposable? toDispose = dsa;
+                DSA? toDispose = dsa;
 
                 try
                 {
index 28cbc90916ddf445d8e2acc3428d3e69db92a0b5..ea141e43f795730dc3a4842f2ce6b1339f8cc2bc 100644 (file)
@@ -5,9 +5,6 @@ namespace System.Security.Cryptography.X509Certificates
 {
     internal sealed partial class X509Pal
     {
-        private static partial IX509Pal BuildSingleton()
-        {
-            return new OpenSslX509Encoder();
-        }
+        private static partial IX509Pal BuildSingleton() => new OpenSslX509Encoder();
     }
 }
index bc3b2b06bc98163418c5bad29cf1932a9ef253d2..71e6ef1db71b19830f6b978be0a7f3f7106a059d 100644 (file)
@@ -56,14 +56,14 @@ namespace System.Security.Cryptography.X509Certificates
                 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;
                     }
index a2c9fb1636df29080dc7a12079d77a3facc975b8..88f7361dd3f0520fddc596d5a1e72ff1b89b51da 100644 (file)
@@ -5,9 +5,6 @@ namespace System.Security.Cryptography.X509Certificates
 {
     internal partial class X509Pal : IX509Pal
     {
-        private static partial IX509Pal BuildSingleton()
-        {
-            return new X509Pal();
-        }
+        private static partial IX509Pal BuildSingleton() => new X509Pal();
     }
 }
index 5d60633639064fe86ee987ff516dff98f6c13ca1..2e07e6803b44b0286efca6364bef825a3d9bb644 100644 (file)
@@ -58,7 +58,7 @@ namespace System.Security.Cryptography.X509Certificates
                 throw new NotSupportedException(SR.NotSupported_KeyAlgorithm);
             }
 
-            private static AsymmetricAlgorithm DecodeRsaPublicKey(byte[] encodedKeyValue)
+            private static RSA DecodeRsaPublicKey(byte[] encodedKeyValue)
             {
                 RSA rsa = RSA.Create();
                 try
@@ -73,7 +73,7 @@ namespace System.Security.Cryptography.X509Certificates
                 }
             }
 
-            private static AsymmetricAlgorithm DecodeDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
+            private static DSA DecodeDsaPublicKey(byte[] encodedKeyValue, byte[] encodedParameters)
             {
                 SubjectPublicKeyInfoAsn spki = new SubjectPublicKeyInfoAsn
                 {
@@ -93,7 +93,7 @@ namespace System.Security.Cryptography.X509Certificates
                 }
 
                 DSA dsa = DSA.Create();
-                IDisposable? toDispose = dsa;
+                DSA? toDispose = dsa;
 
                 try
                 {
index fbacb1aa976a83b60db5d67392bdf9828e88b80d..613d551855e25bb72ce091c95867286e5f108a4c 100644 (file)
@@ -180,6 +180,6 @@ namespace System.Security.Principal
         }
 
         // This is called by AppDomain.GetThreadPrincipal() via reflection.
-        private static IPrincipal GetDefaultInstance() => new WindowsPrincipal(WindowsIdentity.GetCurrent());
+        private static WindowsPrincipal GetDefaultInstance() => new WindowsPrincipal(WindowsIdentity.GetCurrent());
     }
 }
index 5829235afd776934b6f7864fb6a776fd35af1ba4..bf5e6b612db3e7d7e5e2ff402dd5ab7aa2d655ac 100644 (file)
@@ -159,7 +159,7 @@ namespace System.ServiceModel.Syndication
         public XmlReader GetReader()
         {
             EnsureBuffer();
-            XmlReader reader = _buffer.GetReader(0);
+            XmlDictionaryReader reader = _buffer.GetReader(0);
             int index = 0;
             reader.ReadStartElement(Rss20Constants.ExtensionWrapperTag);
             while (reader.IsStartElement())
index f3a4d74eeaac463746a4feb96166cfcc19571b13..fc91489b01342f311310811d8affe1bb0e9c1395 100644 (file)
@@ -96,7 +96,7 @@ namespace System.ServiceModel.Syndication
         public XmlReader GetReaderAtElementExtensions()
         {
             XmlBuffer extensionsBuffer = GetOrCreateBufferOverExtensions();
-            XmlReader reader = extensionsBuffer.GetReader(0);
+            XmlDictionaryReader reader = extensionsBuffer.GetReader(0);
             reader.ReadStartElement();
             return reader;
         }
@@ -205,7 +205,7 @@ namespace System.ServiceModel.Syndication
             }
 
             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)
index 0505eae102f8a9b1a21f315604e7c32ba7071d4e..f57dec531c28e9d7bdef18b1ddb6f5a346c038a2 100644 (file)
@@ -92,7 +92,7 @@ namespace System.ServiceModel
             _stream = null;
         }
 
-        private static Exception CreateInvalidStateException() => new InvalidOperationException(SR.XmlBufferInInvalidState);
+        private static InvalidOperationException CreateInvalidStateException() => new InvalidOperationException(SR.XmlBufferInInvalidState);
 
         public XmlDictionaryReader GetReader(int sectionIndex)
         {
index ee9cf46645101dea59ccd28ad85d35965ae5b2f8..7c4fde5da614cdcbb7d80b527825209fc856f802 100644 (file)
@@ -40,9 +40,9 @@ namespace System.Speech.Internal.ObjectTokens
             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;
 
@@ -83,7 +83,7 @@ namespace System.Speech.Internal.ObjectTokens
 
         IEnumerator<ObjectToken> IEnumerable<ObjectToken>.GetEnumerator()
         {
-            IList<ObjectToken> objectTokenList = FindMatchingTokens(null, null);
+            List<ObjectToken> objectTokenList = FindMatchingTokens(null, null);
 
             foreach (ObjectToken objectToken in objectTokenList)
             {
index f565249184be6d098c35e26c91b5e7211610385a..dede05922d71bd90f33f7ea902a61aff0ff26a4a 100644 (file)
@@ -77,7 +77,7 @@ namespace System.Speech.Internal
         /// 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.
index 3acb36d19cee5991f9ab65ee1813aa9ebec4777e..c21bfeb74a4c2795f30c5032a7f63f31d7ae39a5 100644 (file)
@@ -54,10 +54,10 @@ namespace System.Speech.Internal.SrgsCompiler
                 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());
                 }
             }
 
@@ -100,7 +100,7 @@ namespace System.Speech.Internal.SrgsCompiler
 
         #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();
index 9794db2a4163abc341e5e0f5367762e458dd180b..d09144cb9af05ef30f8d6d6ed4728b26ee8f1e0d 100644 (file)
@@ -1023,7 +1023,7 @@ namespace System.Speech.Recognition
 
         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);
 
index fbaf92785a52166527c277c5c8c9245d5a67579a..e771fca8d9b724176add76c1835d9d8ae3d135cd 100644 (file)
@@ -54,7 +54,7 @@ namespace System.Speech.Synthesis
                     {
                         try
                         {
-                            using (TextReader reader = new StreamReader(stream))
+                            using (var reader = new StreamReader(stream))
                             {
                                 _text = reader.ReadToEnd();
                             }
index e16b1592bf6f5bedaa79fe8f57018edb80fbaa2d..3ba05f53ccc946a9ea2672963e9a0f87bacdf62c 100644 (file)
@@ -84,7 +84,7 @@ namespace System.Text.Json.Serialization.Metadata
             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.
index 7cdb613755bbaeafeefa920c6b2992008b598142..17b610739afc5141a28a3441a36194d4649b94b7 100644 (file)
@@ -193,7 +193,7 @@ namespace System.Text.RegularExpressions.Generator
 
                     try
                     {
-                        _ = RegexParser.ParseOptionsInPattern(argument.Value.ConstantValue.Value as string, RegexOptions.None);
+                        _ = RegexParser.ParseOptionsInPattern((string)argument.Value.ConstantValue.Value!, RegexOptions.None);
                     }
                     catch (RegexParseException)
                     {
index 23d9fce3419e52acec5a06130a5437ab6660b8a3..037fc70dc3ab85d0bfc37d7c35d8b4b9d0dd5d66 100644 (file)
@@ -209,7 +209,7 @@ namespace System.Threading.RateLimiting
             }
         }
 
-        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
index 74a3bd003fbd90c9d65f8551359b6980396602b5..b94937600f94402d1bf974f10ab1c975fbc53c32 100644 (file)
@@ -215,7 +215,7 @@ namespace System.Threading.RateLimiting
             }
         }
 
-        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
index 6305989a73493efe8db19d0a14c3e43507c6f76c..708e4dae8597b70538c51f17448f9c8636cac01b 100644 (file)
@@ -537,7 +537,7 @@ namespace System.Threading.Tasks.Dataflow.Internal
         /// <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>
@@ -561,7 +561,7 @@ namespace System.Threading.Tasks.Dataflow.Internal
         {
             Common.ContractAssertMonitorStatus(_sharedResources._incomingLock, held: true);
 
-            IList<T> toReturn = _messages;
+            List<T> toReturn = _messages;
             _messages = new List<T>();
             return toReturn;
         }
index eb14b86dd9aaa78e66a90739d9f1dd6b1ff6e511..f9300fba381a656496216d62fe3b5d347f1144b7 100644 (file)
@@ -1154,7 +1154,7 @@ namespace System.Threading
             }
         }
 
-        private static ApplicationException GetTimeoutException()
+        private static ReaderWriterLockApplicationException GetTimeoutException()
         {
             return new ReaderWriterLockApplicationException(HResults.ERROR_TIMEOUT, SR.ReaderWriterLock_Timeout);
         }
@@ -1164,7 +1164,7 @@ namespace System.Threading
         /// <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(
@@ -1172,7 +1172,7 @@ namespace System.Threading
                     SR.ReaderWriterLock_NotOwner);
         }
 
-        private static ApplicationException GetInvalidLockCookieException()
+        private static ReaderWriterLockApplicationException GetInvalidLockCookieException()
         {
             return new ReaderWriterLockApplicationException(HResults.E_INVALIDARG, SR.ReaderWriterLock_InvalidLockCookie);
         }
index 1e0cdd68ff1634b484145f4ea914bc6e6b162e04..08e47a090e037d96ca5a8ef0c390becc301c5632 100644 (file)
@@ -1493,7 +1493,7 @@ namespace System.Transactions
             throw CreateTransactionAbortedException(tx);
         }
 
-        private static TransactionException CreateTransactionAbortedException(InternalTransaction tx)
+        private static TransactionAbortedException CreateTransactionAbortedException(InternalTransaction tx)
         {
             return TransactionAbortedException.Create(SR.TransactionAborted, tx._innerException, tx.DistributedTxId);
         }
index b744bbca3464b2081cd29608da4119218838cb31..efcdaf30cc34f05df3d60339817930a6411fb21f 100644 (file)
@@ -501,7 +501,7 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
         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)
@@ -1071,7 +1071,7 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
         }
     }
 
-    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)
index f77f6f604fab93972d8869624e80c149f87cae56..612df3cc9f0fef5aced0bb9b284adf21da6432af 100644 (file)
@@ -106,7 +106,7 @@ public class RuntimeConfigParserTask : Task
 
     /// 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;
 
@@ -118,7 +118,7 @@ public class RuntimeConfigParserTask : Task
         }
     }
 
-    private bool CheckReservedProperties(IReadOnlyDictionary<string, string> properties, ITaskItem[] keys)
+    private bool CheckReservedProperties(Dictionary<string, string> properties, ITaskItem[] keys)
     {
         var succeed = true;
 
index c09633303da203a156d093768fd67c184460967b..aa6d3497d1928310294791bf39211097833dfb34 100644 (file)
@@ -78,7 +78,7 @@ namespace Microsoft.WebAssembly.Build.Tasks
             }
 
             _totalFiles = SourceFiles.Length;
-            IDictionary<string, string> envVarsDict = GetEnvironmentVariablesDict();
+            Dictionary<string, string> envVarsDict = GetEnvironmentVariablesDict();
             ConcurrentBag<ITaskItem> outputItems = new();
             try
             {
@@ -238,7 +238,7 @@ namespace Microsoft.WebAssembly.Build.Tasks
 
             ITaskItem CreateOutputItemFor(string srcFile, string objFile)
             {
-                ITaskItem newItem = new TaskItem(objFile);
+                TaskItem newItem = new TaskItem(objFile);
                 newItem.SetMetadata("SourceFile", srcFile);
                 return newItem;
             }
@@ -291,7 +291,7 @@ namespace Microsoft.WebAssembly.Build.Tasks
             }
         }
 
-        private IDictionary<string, string> GetEnvironmentVariablesDict()
+        private Dictionary<string, string> GetEnvironmentVariablesDict()
         {
             Dictionary<string, string> envVarsDict = new();
             if (EnvironmentVariables == null)