diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig index 307e910d1628e9..abdfba711bcea2 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 3f58c3aab64ea9..dccb23a9e1a8f4 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 48c0903f5e68a0..844cf58f20bd73 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 6211ca306c3e4f..2f3a0c6cefe01b 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 6655703deb3bbd..8c16f9685f8348 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 2b5fe4f608b4e9..12043e18a42e58 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 3fa2e02e88d0f2..8b6242a869e74a 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 41fab1efcdfb9b..b05c1c6ed3a73b 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 2c7ae3b4cc230c..c46d5fecbfb76c 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 6bc91a8ffadb3e..606dbd87429793 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 c4bbe1418891c2..030d46af2a6cc6 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 447387495bd328..845f7627ca3ee3 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 132be8f0f7dfd3..40f16525cd72de 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 ca859bf2f45956..26bfe897c08dfa 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.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj index 91e3394f8534a9..f212430e588bc9 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/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/browser/debugger/BrowserDebugProxy/DebugStore.cs index 6f205766afb647..a6c80c89ac8d82 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 81871b356e16d4..9d70f173db04e7 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/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs index 9b2a4e36456627..d947c2f88a29e5 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 a41e88575de774..3e1e01fb6b8fef 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 de99303f12b7fe..f699127b16c3de 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 43d6f994fd0754..4af4cdc654ab5f 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 d1a4bdbf0570ca..04e22d0dc94cc3 100644 --- a/src/tools/illink/src/linker/Mono.Linker.csproj +++ b/src/tools/illink/src/linker/Mono.Linker.csproj @@ -19,7 +19,7 @@ $(MSBuildThisFileDirectory)ref\Mono.Linker.csproj Major false - $(NoWarn);NU5131 + $(NoWarn);NU5131;CA1866 $(TargetsForTfmSpecificContentInPackage);_AddReferenceAssemblyToPackage $(DefineConstants);ILLINK