Commit 210a7a9
authored
Fix most violations of new CA1859 (#80335)
* 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 replacement1 parent 1630725 commit 210a7a9
File tree
237 files changed
+648
-710
lines changed- src
- coreclr/System.Private.CoreLib/src/System
- Reflection
- Emit
- Runtime/Loader
- libraries
- Common/src
- Interop/Windows/BCrypt
- System/Security/Cryptography
- Microsoft.Extensions.Configuration.Binder/src
- Microsoft.Extensions.Configuration.Json/src
- Microsoft.Extensions.Configuration.Xml/src
- Microsoft.Extensions.Configuration/src
- Microsoft.Extensions.DependencyInjection.Abstractions/src
- Microsoft.Extensions.DependencyInjection/src/ServiceLookup
- Expressions
- Microsoft.Extensions.DependencyModel/src
- Microsoft.Extensions.FileSystemGlobbing/src
- Internal/Patterns
- Microsoft.Extensions.Hosting/src/Internal
- Microsoft.Extensions.Logging.EventLog/src
- Microsoft.NETCore.Platforms/src
- Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices
- System.Collections.Concurrent/src/System/Collections/Concurrent
- System.Collections.Specialized/src/System/Collections/Specialized
- System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations
- System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration
- System.ComponentModel.Composition/src/System/ComponentModel/Composition
- AttributedModel
- Hosting
- ReflectionModel
- System.ComponentModel.TypeConverter/src/System/ComponentModel
- Design
- System.Composition.Convention/src/System/Composition/Convention
- System.Composition.Hosting/src/System/Composition/Hosting/Core
- System.Composition.TypedParts/src/System/Composition
- Hosting
- TypedParts
- Discovery
- System.Configuration.ConfigurationManager/src/System/Configuration
- Internal
- System.Data.Common/src/System
- Data
- Common
- Filter
- SQLTypes
- Xml
- System.Diagnostics.DiagnosticSource/src/System/Diagnostics
- System.Diagnostics.Process/src/System/Diagnostics
- System.Diagnostics.TextWriterTraceListener/src/System/Diagnostics
- System.Diagnostics.TraceSource/src/System/Diagnostics
- System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement
- AD
- SAM
- System.DirectoryServices/src/System/DirectoryServices
- ActiveDirectory
- System.Drawing.Common/src/System/Drawing
- Printing
- System.Formats.Asn1/src/System/Formats/Asn1
- System.Formats.Tar/src/System/Formats/Tar
- System.IO.Compression/src/System/IO/Compression
- System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles
- System.IO.Pipelines/src/System/IO/Pipelines
- System.Linq.Expressions/src/System/Linq/Expressions
- Compiler
- System.Linq.Parallel/src/System/Linq/Parallel
- QueryOperators/Binary
- Utils
- System.Management/src/System/Management
- System.Memory/src/System
- System.Net.HttpListener/src/System/Net
- Managed
- Windows
- WebSockets
- System.Net.Http/src/System/Net/Http
- Headers
- SocketsHttpHandler
- System.Net.Mail/src/System/Net
- Mime
- System.Net.NameResolution/src/System/Net
- System.Net.NetworkInformation/src/System/Net/NetworkInformation
- System.Net.Requests/src/System/Net
- System.Net.Sockets/src/System/Net/Sockets
- System.Net.WebClient/src/System/Net
- System.Net.WebSockets/src/System/Net/WebSockets
- System.Private.CoreLib/src/System
- Diagnostics/Tracing
- TraceLogging
- IO
- Resources
- Threading/Tasks
- System.Private.DataContractSerialization/src/System/Runtime/Serialization
- Json
- System.Private.Xml.Linq/src/System/Xml
- Linq
- XPath
- System.Private.Xml/src/System/Xml
- BinaryXml
- Core
- Dom
- Schema
- Serialization
- XPath
- Internal
- Xsl
- IlGen
- QIL
- XsltOld
- Xslt
- System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading
- Events
- Methods
- System.Resources.Extensions/src/System/Resources/Extensions
- System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator
- Marshaling
- System.Runtime.InteropServices/gen
- LibraryImportGenerator
- Microsoft.Interop.SourceGeneration
- System.Security.Claims/src/System/Security/Claims
- System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal
- AnyOS
- Windows
- System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml
- System.Security.Cryptography/src/System/Security/Cryptography
- X509Certificates
- System.Security.Principal.Windows/src/System/Security/Principal
- System.ServiceModel.Syndication/src/System/ServiceModel
- Syndication
- System.Speech/src
- Internal
- ObjectToken
- SrgsCompiler
- Result
- Synthesis
- System.Text.Json/src/System/Text/Json/Serialization/Metadata
- System.Text.RegularExpressions/gen
- System.Threading.RateLimiting/src/System/Threading/RateLimiting
- System.Threading.Tasks.Dataflow/src/Blocks
- System.Threading/src/System/Threading
- System.Transactions.Local/src/System/Transactions
- tasks
- AotCompilerTask
- MonoTargetsTasks/RuntimeConfigParser
- WasmAppBuilder
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
237 files changed
+648
-710
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1995 | 1995 | | |
1996 | 1996 | | |
1997 | 1997 | | |
1998 | | - | |
| 1998 | + | |
1999 | 1999 | | |
2000 | 2000 | | |
2001 | 2001 | | |
| |||
3166 | 3166 | | |
3167 | 3167 | | |
3168 | 3168 | | |
3169 | | - | |
| 3169 | + | |
3170 | 3170 | | |
3171 | 3171 | | |
3172 | 3172 | | |
| |||
3182 | 3182 | | |
3183 | 3183 | | |
3184 | 3184 | | |
3185 | | - | |
| 3185 | + | |
3186 | 3186 | | |
3187 | 3187 | | |
3188 | 3188 | | |
| |||
3198 | 3198 | | |
3199 | 3199 | | |
3200 | 3200 | | |
3201 | | - | |
| 3201 | + | |
3202 | 3202 | | |
3203 | 3203 | | |
3204 | 3204 | | |
| |||
3214 | 3214 | | |
3215 | 3215 | | |
3216 | 3216 | | |
3217 | | - | |
| 3217 | + | |
3218 | 3218 | | |
3219 | 3219 | | |
3220 | 3220 | | |
| |||
3230 | 3230 | | |
3231 | 3231 | | |
3232 | 3232 | | |
3233 | | - | |
| 3233 | + | |
3234 | 3234 | | |
3235 | 3235 | | |
3236 | 3236 | | |
| |||
3246 | 3246 | | |
3247 | 3247 | | |
3248 | 3248 | | |
3249 | | - | |
| 3249 | + | |
3250 | 3250 | | |
3251 | 3251 | | |
3252 | 3252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | | - | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
795 | | - | |
| 795 | + | |
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
905 | | - | |
| 905 | + | |
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
694 | | - | |
| 694 | + | |
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
| 730 | + | |
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
979 | | - | |
| 979 | + | |
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
0 commit comments