diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig
index 307e910d1628e..abdfba711bcea 100644
--- a/eng/CodeAnalysis.src.globalconfig
+++ b/eng/CodeAnalysis.src.globalconfig
@@ -489,6 +489,15 @@ dotnet_diagnostic.CA1863.severity = suggestion
# CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
dotnet_diagnostic.CA1864.severity = warning
+# CA1865: Use char overload
+dotnet_diagnostic.CA1865.severity = warning
+
+# CA1866: Use char overload
+dotnet_diagnostic.CA1866.severity = warning
+
+# CA1867: Use char overload
+dotnet_diagnostic.CA1867.severity = warning
+
# CA1868: Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = warning
@@ -501,6 +510,9 @@ dotnet_diagnostic.CA1870.severity = warning
# CA1871: Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA1871.severity = warning
+# CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'
+dotnet_diagnostic.CA1872.severity = warning
+
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
@@ -610,9 +622,6 @@ dotnet_diagnostic.CA2226.severity = none
# CA2227: Collection properties should be read only
dotnet_diagnostic.CA2227.severity = none
-# CA2229: Implement serialization constructors
-dotnet_diagnostic.CA2229.severity = warning
-
# CA2231: Overload operator equals on overriding value type Equals
dotnet_diagnostic.CA2231.severity = none
@@ -692,7 +701,7 @@ dotnet_diagnostic.CA2261.severity = warning
dotnet_diagnostic.CA2262.severity = warning
# CA2263: Prefer generic overload when type is known
-dotnet_diagnostic.CA2263.severity = info
+dotnet_diagnostic.CA2263.severity = suggestion
# CA2264: Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA2264.severity = warning
@@ -1827,7 +1836,7 @@ dotnet_diagnostic.IDE0200.severity = warning
# IDE0210: Use top-level statements
dotnet_diagnostic.IDE0210.severity = none
-# IDE0211: Use program main
+# IDE0211: Convert to 'Program.Main' style program
dotnet_diagnostic.IDE0211.severity = none
# IDE0220: foreach cast
@@ -1845,6 +1854,9 @@ dotnet_diagnostic.IDE0241.severity = suggestion
# IDE0250: Make struct readonly
dotnet_diagnostic.IDE0250.severity = suggestion
+# IDE0251: Make member readonly
+dotnet_diagnostic.IDE0251.severity = suggestion
+
# IDE0260: Use pattern matching
dotnet_diagnostic.IDE0260.severity = suggestion
@@ -1854,6 +1866,27 @@ dotnet_diagnostic.IDE0270.severity = suggestion
# IDE0280: Use 'nameof'
dotnet_diagnostic.IDE0280.severity = warning
+# IDE0290: Use primary constructor
+dotnet_diagnostic.IDE0290.severity = suggestion
+
+# IDE0300: Use collection expression for array
+dotnet_diagnostic.IDE0300.severity = suggestion
+
+# IDE0301: Use collection expression for empty
+dotnet_diagnostic.IDE0301.severity = suggestion
+
+# IDE0302: Use collection expression for stackalloc
+dotnet_diagnostic.IDE0302.severity = suggestion
+
+# IDE0303: Use collection expression for Create()
+dotnet_diagnostic.IDE0303.severity = suggestion
+
+# IDE0304: Use collection expression for builder
+dotnet_diagnostic.IDE0304.severity = suggestion
+
+# IDE0305: Use collection expression for fluent
+dotnet_diagnostic.IDE0305.severity = suggestion
+
# IDE1005: Delegate invocation can be simplified.
dotnet_diagnostic.IDE1005.severity = warning
@@ -1874,3 +1907,9 @@ dotnet_diagnostic.IDE2003.severity = silent
# IDE2004: Blank line not allowed after constructor initializer colon
dotnet_diagnostic.IDE2004.severity = silent
+
+# IDE2005: Blank line not allowed after conditional expression token
+dotnet_diagnostic.IDE2005.severity = silent
+
+# IDE2006: Blank line not allowed after arrow expression clause token
+dotnet_diagnostic.IDE2006.severity = silent
diff --git a/eng/CodeAnalysis.test.globalconfig b/eng/CodeAnalysis.test.globalconfig
index 3f58c3aab64ea..dccb23a9e1a8f 100644
--- a/eng/CodeAnalysis.test.globalconfig
+++ b/eng/CodeAnalysis.test.globalconfig
@@ -486,6 +486,15 @@ dotnet_diagnostic.CA1863.severity = none
# CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
dotnet_diagnostic.CA1864.severity = none
+# CA1865: Use char overload
+dotnet_diagnostic.CA1865.severity = none
+
+# CA1866: Use char overload
+dotnet_diagnostic.CA1866.severity = none
+
+# CA1867: Use char overload
+dotnet_diagnostic.CA1867.severity = none
+
# CA1868: Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = none
@@ -498,6 +507,9 @@ dotnet_diagnostic.CA1870.severity = none
# CA1871: Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA1871.severity = none
+# CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'
+dotnet_diagnostic.CA1872.severity = none
+
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
@@ -1821,7 +1833,7 @@ dotnet_diagnostic.IDE0200.severity = silent
# IDE0210: Use top-level statements
dotnet_diagnostic.IDE0210.severity = silent
-# IDE0211: Use program main
+# IDE0211: Convert to 'Program.Main' style program
dotnet_diagnostic.IDE0211.severity = silent
# IDE0220: foreach cast
@@ -1839,6 +1851,9 @@ dotnet_diagnostic.IDE0241.severity = silent
# IDE0250: Make struct readonly
dotnet_diagnostic.IDE0250.severity = silent
+# IDE0251: Make member readonly
+dotnet_diagnostic.IDE0251.severity = silent
+
# IDE0260: Use pattern matching
dotnet_diagnostic.IDE0260.severity = silent
@@ -1848,6 +1863,27 @@ dotnet_diagnostic.IDE0270.severity = silent
# IDE0280: Use 'nameof'
dotnet_diagnostic.IDE0280.severity = silent
+# IDE0290: Use primary constructor
+dotnet_diagnostic.IDE0290.severity = silent
+
+# IDE0300: Use collection expression for array
+dotnet_diagnostic.IDE0300.severity = silent
+
+# IDE0301: Use collection expression for empty
+dotnet_diagnostic.IDE0301.severity = silent
+
+# IDE0302: Use collection expression for stackalloc
+dotnet_diagnostic.IDE0302.severity = silent
+
+# IDE0303: Use collection expression for Create()
+dotnet_diagnostic.IDE0303.severity = silent
+
+# IDE0304: Use collection expression for builder
+dotnet_diagnostic.IDE0304.severity = silent
+
+# IDE0305: Use collection expression for fluent
+dotnet_diagnostic.IDE0305.severity = silent
+
# IDE1005: Delegate invocation can be simplified.
dotnet_diagnostic.IDE1005.severity = silent
@@ -1869,6 +1905,12 @@ dotnet_diagnostic.IDE2003.severity = silent
# IDE2004: Blank line not allowed after constructor initializer colon
dotnet_diagnostic.IDE2004.severity = silent
+# IDE2005: Blank line not allowed after conditional expression token
+dotnet_diagnostic.IDE2005.severity = silent
+
+# IDE2006: Blank line not allowed after arrow expression clause token
+dotnet_diagnostic.IDE2006.severity = silent
+
# xUnit1000: Test classes must be public
dotnet_diagnostic.xUnit1000.severity = warning
diff --git a/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs b/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs
index 48c0903f5e68a..844cf58f20bd7 100644
--- a/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs
+++ b/src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs
@@ -108,7 +108,7 @@ private string SanitizeNameWithHash(string literal)
hash = SHA256.HashData(GetBytesFromString(literal));
}
- mangledName += "_" + BitConverter.ToString(hash).Replace("-", "");
+ mangledName += "_" + Convert.ToHexString(hash);
}
return mangledName;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/CoffObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/CoffObjectWriter.cs
index 6211ca306c3e4..2f3a0c6cefe01 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/CoffObjectWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/CoffObjectWriter.cs
@@ -92,7 +92,7 @@ private protected override void CreateSection(ObjectNodeSection section, string
Name =
section == ObjectNodeSection.TLSSection ? ".tls$" :
section == ObjectNodeSection.HydrationTargetSection ? "hydrated" :
- (section.Name.StartsWith(".") ? section.Name : "." + section.Name),
+ (section.Name.StartsWith('.') ? section.Name : "." + section.Name),
SectionCharacteristics = section.Type switch
{
SectionType.ReadOnly =>
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/RuntimeConfigurationRootProvider.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/RuntimeConfigurationRootProvider.cs
index 6655703deb3bb..8c16f9685f834 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/RuntimeConfigurationRootProvider.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/RuntimeConfigurationRootProvider.cs
@@ -72,7 +72,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
int valueIndex = 0;
foreach (string line in _runtimeOptions)
{
- int indexOfEquals = line.IndexOf("=");
+ int indexOfEquals = line.IndexOf('=');
if (indexOfEquals > 0)
{
string key = line.Substring(0, indexOfEquals);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/XmlObjectDumper.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/XmlObjectDumper.cs
index 2b5fe4f608b4e..12043e18a42e5 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/XmlObjectDumper.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/XmlObjectDumper.cs
@@ -70,7 +70,7 @@ protected override void DumpObjectNode(NodeFactory nodeFactory, ObjectNode node,
private string HashData(byte[] data)
{
- return BitConverter.ToString(_sha256.ComputeHash(data)).Replace("-", "").ToLowerInvariant();
+ return Convert.ToHexStringLower(_sha256.ComputeHash(data));
}
internal override void End()
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
index 190544b31373d..37c8c2108d917 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
@@ -4,6 +4,7 @@
ILCompiler.Compiler
$(NetCoreAppToolCurrent)
true
+ $(NoWarn);CA1866;CA1867
false
x64;x86
AnyCPU
diff --git a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
index 41fab1efcdfb9..b05c1c6ed3a73 100644
--- a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
@@ -373,7 +373,7 @@ public void Write(Stream stream)
// 3rd, the name, Quote the string if not already quoted
string asString = rec.ToString(false);
- bool alreadyQuoted = asString.StartsWith("\"") && asString.EndsWith("\"");
+ bool alreadyQuoted = asString.StartsWith('\"') && asString.EndsWith('\"');
if (!alreadyQuoted)
{
LogWriter.Write("\"");
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
index 2c7ae3b4cc230..c46d5fecbfb76 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
@@ -5,6 +5,7 @@
ILCompiler.TypeSystem
true
$(NetCoreAppToolCurrent)
+ $(NoWarn);CA1866
false
x64;x86
AnyCPU
diff --git a/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/Microsoft.Extensions.Configuration.CommandLine.csproj b/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/Microsoft.Extensions.Configuration.CommandLine.csproj
index 6bc91a8ffadb3..606dbd8742979 100644
--- a/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/Microsoft.Extensions.Configuration.CommandLine.csproj
+++ b/src/libraries/Microsoft.Extensions.Configuration.CommandLine/src/Microsoft.Extensions.Configuration.CommandLine.csproj
@@ -2,6 +2,7 @@
$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)
+ $(NoWarn);CA1866
true
true
Command line configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read configuration parameters from the command line arguments of your application. You can use CommandLineConfigurationExtensions.AddCommandLine extension method on IConfigurationBuilder to add the command line configuration provider to the configuration builder.
diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj
index c4bbe1418891c..030d46af2a6cc 100644
--- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj
+++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj
@@ -4,6 +4,7 @@
$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)
Microsoft.Extensions.FileProviders
true
+ $(NoWarn);CA1865;CA1866
true
true
File provider for physical files for Microsoft.Extensions.FileProviders.
diff --git a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
index 447387495bd32..845f7627ca3ee 100644
--- a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
+++ b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
@@ -5,7 +5,7 @@
$(TargetFrameworks);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious)
true
true
- $(NoWarn);IDE0059;IDE0060;CA1822
+ $(NoWarn);IDE0059;IDE0060;CA1822;CA1865
false
false
true
diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj
index 132be8f0f7dfd..40f16525cd72d 100644
--- a/src/libraries/System.Management/src/System.Management.csproj
+++ b/src/libraries/System.Management/src/System.Management.csproj
@@ -5,7 +5,7 @@
$(TargetFrameworks);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious)
true
$(NoWarn);0618
- $(NoWarn);IDE0059;IDE0060;CA1822
+ $(NoWarn);IDE0059;IDE0060;CA1822;CA1865
true
false
true
diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System.Reflection.MetadataLoadContext.csproj b/src/libraries/System.Reflection.MetadataLoadContext/src/System.Reflection.MetadataLoadContext.csproj
index ca859bf2f4595..26bfe897c08df 100644
--- a/src/libraries/System.Reflection.MetadataLoadContext/src/System.Reflection.MetadataLoadContext.csproj
+++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System.Reflection.MetadataLoadContext.csproj
@@ -7,6 +7,7 @@
false
false
true
+ $(NoWarn);CA1865
Provides read-only reflection on assemblies in an isolated context with support for assemblies that target different processor architectures and runtimes. Using MetadataLoadContext enables you to inspect assemblies without loading them into the main execution context. Assemblies in MetadataLoadContext are treated only as metadata, that is, you can read information about their members, but cannot execute any code contained in them.
diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
index abadf7f1d0191..b62f347a00d05 100644
--- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
+++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
@@ -333,7 +333,7 @@ public static (string assemblyName, string nameSpace, string shortClassName, str
var nameSpace = "";
var shortClassName = className;
- var idx = fqn.LastIndexOf(".");
+ var idx = fqn.LastIndexOf('.');
if (idx != -1)
{
nameSpace = fqn.Substring(0, idx);
diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
index 91e3394f8534a..f212430e588bc 100644
--- a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
+++ b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
@@ -4,7 +4,7 @@
$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)
$(TargetFrameworks);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious)
true
- $(NoWarn);CA2249
+ $(NoWarn);CA2249;CA1865
false
true
Provides the System.ServiceProcess.ServiceController class, which allows you to connect to a Windows service, manipulate it, or get information about it.
diff --git a/src/libraries/System.Text.Encodings.Web/tools/GenDefinedCharList/Program.cs b/src/libraries/System.Text.Encodings.Web/tools/GenDefinedCharList/Program.cs
index 4168d6fc301be..ef9604ab30201 100644
--- a/src/libraries/System.Text.Encodings.Web/tools/GenDefinedCharList/Program.cs
+++ b/src/libraries/System.Text.Encodings.Web/tools/GenDefinedCharList/Program.cs
@@ -204,7 +204,7 @@ private static bool IsRangeDefinition(string rawName, out string rangeName, out
// Ranges are represented within angle brackets, such as the following:
// DC00;;Cs;0;L;;;;;N;;;;;
// DFFF;;Cs;0;L;;;;;N;;;;;
- if (rawName.StartsWith("<", StringComparison.Ordinal))
+ if (rawName.StartsWith('<'))
{
if (rawName.EndsWith(", First>", StringComparison.Ordinal))
{
diff --git a/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexReductionTests.cs b/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexReductionTests.cs
index cb28e55387b73..c10622548e285 100644
--- a/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexReductionTests.cs
+++ b/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexReductionTests.cs
@@ -582,7 +582,7 @@ public void MinMaxLengthIsCorrect(string pattern, int options, int expectedMin,
Assert.Equal(expectedMin, tree.FindOptimizations.MinRequiredLength);
- if (!pattern.EndsWith("$", StringComparison.Ordinal) &&
+ if (!pattern.EndsWith('$') &&
!pattern.EndsWith(@"\Z", StringComparison.OrdinalIgnoreCase))
{
// MaxPossibleLength is currently only computed/stored if there's a trailing End{Z} anchor as the max length is otherwise unused
diff --git a/src/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs
index 6f205766afb64..a6c80c89ac8d8 100644
--- a/src/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs
+++ b/src/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs
@@ -1446,7 +1446,7 @@ private void GetSourceLinkUrl(string document, Dictionary source
{
string key = sourceLinkDocument.Key;
- if (!key.EndsWith("*", StringComparison.OrdinalIgnoreCase))
+ if (!key.EndsWith('*'))
{
continue;
}
diff --git a/src/mono/browser/debugger/BrowserDebugProxy/MonoSDBHelper.cs b/src/mono/browser/debugger/BrowserDebugProxy/MonoSDBHelper.cs
index 81871b356e16d..9d70f173db04e 100644
--- a/src/mono/browser/debugger/BrowserDebugProxy/MonoSDBHelper.cs
+++ b/src/mono/browser/debugger/BrowserDebugProxy/MonoSDBHelper.cs
@@ -1373,7 +1373,7 @@ public async Task GetAssemblyFileNameFromId(int assemblyId, Cancellation
using var retDebuggerCmdReader = await SendDebuggerAgentCommand(CmdAssembly.GetName, commandParamsWriter, token);
var name = retDebuggerCmdReader.ReadString();
- return name.Remove(name.IndexOf(",")) + ".dll";
+ return name.Remove(name.IndexOf(',')) + ".dll";
}
public async Task GetMethodName(int methodId, CancellationToken token)
@@ -2185,7 +2185,7 @@ public async Task GetHoistedLocalVariables(MethodInfoWithDebugInformatio
asyncLocal["name"] = match.Groups["varName"].Value;
}
}
- else if (fieldName.StartsWith("$"))
+ else if (fieldName.StartsWith('$'))
{
continue;
}
diff --git a/src/mono/wasm/host/Options.cs b/src/mono/wasm/host/Options.cs
index 78c22be9382de..9743297cfd0a7 100644
--- a/src/mono/wasm/host/Options.cs
+++ b/src/mono/wasm/host/Options.cs
@@ -746,7 +746,7 @@ public override string Description
public override bool GetArguments(string value, out IEnumerable replacement)
{
- if (string.IsNullOrEmpty(value) || !value.StartsWith("@"))
+ if (string.IsNullOrEmpty(value) || !value.StartsWith('@'))
{
replacement = null;
return false;
diff --git a/src/mono/wasm/host/WasmAppHost.csproj b/src/mono/wasm/host/WasmAppHost.csproj
index 0fea53c84cf5a..b6c8fa42fc25d 100644
--- a/src/mono/wasm/host/WasmAppHost.csproj
+++ b/src/mono/wasm/host/WasmAppHost.csproj
@@ -3,7 +3,7 @@
$(AspNetCoreAppCurrent)
true
- $(NoWarn),CA2007
+ $(NoWarn);CA2007
enable
false
LatestMajor
diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs
index 9b2a4e3645662..d947c2f88a29e 100644
--- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs
+++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs
@@ -206,7 +206,7 @@ public ApkBuilder(TaskLoggingHelper logger)
// also, aapt is not happy about zip files
return false;
}
- if (fileName.StartsWith("."))
+ if (fileName.StartsWith('.'))
{
// aapt complains on such files
return false;
diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj
index a41e88575de77..3e1e01fb6b8fe 100644
--- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj
+++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj
@@ -2,7 +2,7 @@
$(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent)
- $(NoWarn),CA1050,CA1850,CA1845,CA1859,NU5128
+ $(NoWarn),CA1050,CA1850,CA1845,CA1859;CA1866,NU5128
Microsoft.NET.Sdk.WebAssembly
true
true
diff --git a/src/tools/illink/src/linker/Linker/Driver.cs b/src/tools/illink/src/linker/Linker/Driver.cs
index de99303f12b7f..f699127b16c3d 100644
--- a/src/tools/illink/src/linker/Linker/Driver.cs
+++ b/src/tools/illink/src/linker/Linker/Driver.cs
@@ -100,7 +100,7 @@ public static bool ProcessResponseFile (string[] args, out Queue result)
{
result = new Queue ();
foreach (string arg in args) {
- if (arg.StartsWith ("@")) {
+ if (arg.StartsWith ('@')) {
try {
string responseFileName = arg.Substring (1);
using (var responseFileText = new StreamReader (responseFileName))
@@ -933,7 +933,7 @@ protected bool AddMarkHandler (Pipeline pipeline, string arg)
bool TryGetCustomAssembly (ref string arg, [NotNullWhen (true)] out Assembly? assembly)
{
assembly = null;
- int pos = arg.IndexOf (",");
+ int pos = arg.IndexOf (',');
if (pos == -1)
return false;
@@ -963,7 +963,7 @@ protected bool AddCustomStep (Pipeline pipeline, string arg)
}
customStepName = parts[1];
- if (!parts[0].StartsWith ("-") && !parts[0].StartsWith ("+")) {
+ if (!parts[0].StartsWith ('-') && !parts[0].StartsWith ('+')) {
Context.LogError (null, DiagnosticId.ExpectedSignToControlNewStepInsertion);
return false;
}
@@ -1239,7 +1239,7 @@ bool GetBoolParam (string token, Action action)
return true;
}
- if (arg.StartsWith ("-") || arg.StartsWith ("/")) {
+ if (arg.StartsWith ('-') || arg.StartsWith ('/')) {
action (true);
return true;
}
@@ -1272,7 +1272,7 @@ bool GetStringParam (string token, [NotNullWhen (true)] out string? value)
return null;
var arg = arguments.Peek ();
- if (arg.StartsWith ("-") || arg.StartsWith ("/"))
+ if (arg.StartsWith ('-') || arg.StartsWith ('/'))
return null;
arguments.Dequeue ();
diff --git a/src/tools/illink/src/linker/Linker/LinkContext.cs b/src/tools/illink/src/linker/Linker/LinkContext.cs
index 43d6f994fd075..4af4cdc654ab5 100644
--- a/src/tools/illink/src/linker/Linker/LinkContext.cs
+++ b/src/tools/illink/src/linker/Linker/LinkContext.cs
@@ -267,7 +267,7 @@ public bool HasFeatureValue (string feature, bool value)
public TypeDefinition? GetType (string fullName)
{
- int pos = fullName.IndexOf (",");
+ int pos = fullName.IndexOf (',');
fullName = TypeReferenceExtensions.ToCecilName (fullName);
if (pos == -1) {
foreach (AssemblyDefinition asm in GetReferencedAssemblies ()) {
diff --git a/src/tools/illink/src/linker/Mono.Linker.csproj b/src/tools/illink/src/linker/Mono.Linker.csproj
index d1a4bdbf0570c..f19ff4063e68c 100644
--- a/src/tools/illink/src/linker/Mono.Linker.csproj
+++ b/src/tools/illink/src/linker/Mono.Linker.csproj
@@ -16,6 +16,7 @@
false
$(NoWarn);CS8524
+ $(NoWarn);CA1866
$(MSBuildThisFileDirectory)ref\Mono.Linker.csproj
Major
false