Apply code fixes from recently added analyzers#36097
Conversation
src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Data.Odbc/src/Common/System/Data/Common/AdapterUtil.Odbc.cs
Outdated
Show resolved
Hide resolved
...on.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs
Outdated
Show resolved
Hide resolved
da39c94 to
c8e7440
Compare
|
Friendly bump. Can I get a stamp on this please? |
| <AssemblyName>System.Net.WebSockets</AssemblyName> | ||
| <AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
| <NoWarn>$(NoWarn);CS1573</NoWarn> | ||
| <NoWarn>$(NoWarn);CS1573;CA2249</NoWarn> |
There was a problem hiding this comment.
Why was this rule disabled here?
| <AssemblyName>System.Data.Common</AssemblyName> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <NoWarn>$(NoWarn);CS1573</NoWarn> | ||
| <NoWarn>$(NoWarn);CS1573;CA2249</NoWarn> |
There was a problem hiding this comment.
Why was this rule disabled here? (Questioning it because this project only targets netcoreapp)
There was a problem hiding this comment.
I honestly had the same questions. The CI build failed here without suppressing CA2249 even though the target says netcoreapp. I just assumed our build infra was also building this for another config somehow. Actually, let's test it again now
| <WarningLevel>4</WarningLevel> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <NoWarn>$(NoWarn),0419,0649</NoWarn> | ||
| <NoWarn>$(NoWarn),0419,0649,CA2249,CA1830</NoWarn> |
There was a problem hiding this comment.
Why are these disabled for corelib?
There was a problem hiding this comment.
CA2249 is "Prefer string.Contains over string.IndexOf" and CA1830 is "Prefer typed StringBuilder overloads". Both these APIs are defined in corelib right? So they'd trigger the analyzer but there's nothing to do other than suppress them. I could make the suppression local if you'd prefer that
Code-fixes triggered by dotnet/roslyn-analyzers#3610 and #33786
I've been careful to make changes only on the projects that target netstandard2.1+ and add the analyzer to the
NoWarntags for the ones that also target 2.0.