From b61f8a55b99c65214182de34664df75e83c8323e Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sun, 2 Jan 2022 11:21:56 +1000 Subject: [PATCH 01/11] CA1200: Avoid using cref tags with a prefix --- eng/CodeAnalysis.ruleset | 2 +- src/Build/Collections/RetrievableEntryHashSet/HashSet.cs | 2 +- src/Build/Construction/ProjectElementContainer.cs | 2 +- src/Build/Graph/ProjectGraph.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 2078c42fe6c..1821bec9b08 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -54,7 +54,7 @@ - + diff --git a/src/Build/Collections/RetrievableEntryHashSet/HashSet.cs b/src/Build/Collections/RetrievableEntryHashSet/HashSet.cs index 001c7b87f69..e030dcce31a 100644 --- a/src/Build/Collections/RetrievableEntryHashSet/HashSet.cs +++ b/src/Build/Collections/RetrievableEntryHashSet/HashSet.cs @@ -43,7 +43,7 @@ namespace Microsoft.Build.Collections { /// /// Implementation notes: - /// This uses an array-based implementation similar to , using a buckets array + /// This uses an array-based implementation similar to , using a buckets array /// to map hash values to the Slots array. Items in the Slots array that hash to the same value /// are chained together through the "next" indices. /// diff --git a/src/Build/Construction/ProjectElementContainer.cs b/src/Build/Construction/ProjectElementContainer.cs index 3c4c0d6f269..b7395112955 100644 --- a/src/Build/Construction/ProjectElementContainer.cs +++ b/src/Build/Construction/ProjectElementContainer.cs @@ -316,7 +316,7 @@ public void RemoveChild(ProjectElement child) /// /// /// It is safe to modify the children in this way - /// during enumeration. See . + /// during enumeration. See . /// public void RemoveAllChildren() { diff --git a/src/Build/Graph/ProjectGraph.cs b/src/Build/Graph/ProjectGraph.cs index 40cf6aee0ed..72ee0c07f0e 100644 --- a/src/Build/Graph/ProjectGraph.cs +++ b/src/Build/Graph/ProjectGraph.cs @@ -351,7 +351,7 @@ public ProjectGraph( /// on for other scenarios. /// /// - /// The token to observe. + /// The token to observe. /// /// /// If the evaluation of any project in the graph fails @@ -395,7 +395,7 @@ public ProjectGraph( /// Number of threads to participate in building the project graph. /// /// - /// The token to observe. + /// The token to observe. /// /// /// If the evaluation of any project in the graph fails From 41664427ec9e371fd1c2a5c5ef61d35bd54964d9 Mon Sep 17 00:00:00 2001 From: Lachlan Ennis <2433737+elachlan@users.noreply.github.com> Date: Mon, 3 Jan 2022 10:13:51 +1000 Subject: [PATCH 02/11] Update src/Build/Construction/ProjectElementContainer.cs Co-authored-by: Sam Harwell --- src/Build/Construction/ProjectElementContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Build/Construction/ProjectElementContainer.cs b/src/Build/Construction/ProjectElementContainer.cs index b7395112955..3941349dff7 100644 --- a/src/Build/Construction/ProjectElementContainer.cs +++ b/src/Build/Construction/ProjectElementContainer.cs @@ -316,7 +316,7 @@ public void RemoveChild(ProjectElement child) /// /// /// It is safe to modify the children in this way - /// during enumeration. See . + /// during enumeration. See . /// public void RemoveAllChildren() { From 7fa37b212eac5d29982375fb8334d71d8e397579 Mon Sep 17 00:00:00 2001 From: Lachlan Ennis <2433737+elachlan@users.noreply.github.com> Date: Mon, 3 Jan 2022 10:14:20 +1000 Subject: [PATCH 03/11] Update src/Build/Graph/ProjectGraph.cs Co-authored-by: Sam Harwell --- src/Build/Graph/ProjectGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Build/Graph/ProjectGraph.cs b/src/Build/Graph/ProjectGraph.cs index 72ee0c07f0e..880621e9d92 100644 --- a/src/Build/Graph/ProjectGraph.cs +++ b/src/Build/Graph/ProjectGraph.cs @@ -395,7 +395,7 @@ public ProjectGraph( /// Number of threads to participate in building the project graph. /// /// - /// The token to observe. + /// The to observe. /// /// /// If the evaluation of any project in the graph fails From 141ec75edc2598a8a86a327ad71742375415d042 Mon Sep 17 00:00:00 2001 From: Lachlan Ennis <2433737+elachlan@users.noreply.github.com> Date: Mon, 3 Jan 2022 10:14:25 +1000 Subject: [PATCH 04/11] Update src/Build/Graph/ProjectGraph.cs Co-authored-by: Sam Harwell --- src/Build/Graph/ProjectGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Build/Graph/ProjectGraph.cs b/src/Build/Graph/ProjectGraph.cs index 880621e9d92..53a74fa23c1 100644 --- a/src/Build/Graph/ProjectGraph.cs +++ b/src/Build/Graph/ProjectGraph.cs @@ -351,7 +351,7 @@ public ProjectGraph( /// on for other scenarios. /// /// - /// The token to observe. + /// The to observe. /// /// /// If the evaluation of any project in the graph fails From 9d4f418403ee44ff3d4bd40ad23337d7b6f9f221 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Fri, 7 Jan 2022 18:30:29 +1000 Subject: [PATCH 05/11] Changes from review --- src/Build/Definition/ProjectCollection.cs | 3 ++- src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs | 10 +++++++--- src/Build/Microsoft.Build.csproj | 5 +++-- src/Framework/Sdk/SdkResolver.cs | 4 ++-- src/Tasks/Hash.cs | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index 8629bd94317..a8886ba9016 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -26,6 +26,7 @@ using InvalidProjectFileException = Microsoft.Build.Exceptions.InvalidProjectFileException; using LoggerMode = Microsoft.Build.BackEnd.Logging.LoggerMode; using ObjectModel = System.Collections.ObjectModel; +using Microsoft.Build.BuildEngine; namespace Microsoft.Build.Evaluation { @@ -432,7 +433,7 @@ public static ProjectCollection GlobalProjectCollection /// This is the Windows file version (specifically the value of the FileVersion /// resource), not necessarily the assembly version. /// If you want the assembly version, use Constants.AssemblyVersion. - /// This is not the ToolsetCollectionVersion. + /// This is not the . /// public static Version Version { diff --git a/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs b/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs index c6be1d59db3..12d93e50400 100644 --- a/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs +++ b/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs @@ -53,9 +53,9 @@ public class BuildEventArgsReader : IDisposable typeof(BuildEventArgs).GetField("senderName", BindingFlags.Instance | BindingFlags.NonPublic); /// - /// Initializes a new instance of BuildEventArgsReader using a BinaryReader instance + /// Initializes a new instance of using a instance. /// - /// The BinaryReader to read BuildEventArgs from + /// The to read from. /// The file format version of the log file being read. public BuildEventArgsReader(BinaryReader binaryReader, int fileFormatVersion) { @@ -79,8 +79,12 @@ public void Dispose() internal event Action OnBlobRead; /// - /// Reads the next log record from the binary reader. If there are no more records, returns null. + /// Reads the next log record from the . /// + /// + /// The next . + /// If there are no more records, returns . + /// public BuildEventArgs Read() { BinaryLogRecordKind recordKind = (BinaryLogRecordKind)ReadInt32(); diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj index cd99bc84721..32afe070a74 100644 --- a/src/Build/Microsoft.Build.csproj +++ b/src/Build/Microsoft.Build.csproj @@ -1,4 +1,4 @@ - + @@ -21,12 +21,13 @@ This package contains the $(MSBuildProjectName) assembly which is used to create, edit, and evaluate MSBuild projects. false full - + $(NoWarn);NU5104 + diff --git a/src/Framework/Sdk/SdkResolver.cs b/src/Framework/Sdk/SdkResolver.cs index 9280c30af24..8921ae80a59 100644 --- a/src/Framework/Sdk/SdkResolver.cs +++ b/src/Framework/Sdk/SdkResolver.cs @@ -27,11 +27,11 @@ public abstract class SdkResolver /// Factory class to create an /// /// An containing the resolved SDKs or associated error / reason - /// the SDK could not be resolved. Return null if the resolver is not + /// the SDK could not be resolved. Return if the resolver is not /// applicable for a particular . /// /// - /// Note: You must use to return a result. + /// Note: You must use to return a result. /// /// public abstract SdkResult Resolve(SdkReference sdkReference, SdkResolverContext resolverContext, diff --git a/src/Tasks/Hash.cs b/src/Tasks/Hash.cs index 81699764e51..bed1cd6dda4 100644 --- a/src/Tasks/Hash.cs +++ b/src/Tasks/Hash.cs @@ -13,8 +13,8 @@ namespace Microsoft.Build.Tasks /// Generates a hash of a given ItemGroup items. Metadata is not considered in the hash. /// /// - /// Currently uses SHA1. Implementation subject to change between MSBuild versions. Not - /// intended as a cryptographic security measure, only uniqueness between build executions. + /// Currently uses SHA1. Implementation subject to change between MSBuild versions. + /// This class is not intended as a cryptographic security measure, only uniqueness between build executions. /// public class Hash : TaskExtension { From d7365dc3d067a419fe549e18184e92434ededc6b Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Fri, 7 Jan 2022 19:17:00 +1000 Subject: [PATCH 06/11] Revert the project file changes and fix the documentation to use up-to-date reference. --- src/Build/Definition/ProjectCollection.cs | 3 +-- src/Build/Microsoft.Build.csproj | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index a8886ba9016..3b41c557700 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -26,7 +26,6 @@ using InvalidProjectFileException = Microsoft.Build.Exceptions.InvalidProjectFileException; using LoggerMode = Microsoft.Build.BackEnd.Logging.LoggerMode; using ObjectModel = System.Collections.ObjectModel; -using Microsoft.Build.BuildEngine; namespace Microsoft.Build.Evaluation { @@ -433,7 +432,7 @@ public static ProjectCollection GlobalProjectCollection /// This is the Windows file version (specifically the value of the FileVersion /// resource), not necessarily the assembly version. /// If you want the assembly version, use Constants.AssemblyVersion. - /// This is not the . + /// This is not a . /// public static Version Version { diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj index 32afe070a74..cd99bc84721 100644 --- a/src/Build/Microsoft.Build.csproj +++ b/src/Build/Microsoft.Build.csproj @@ -1,4 +1,4 @@ - + @@ -21,13 +21,12 @@ This package contains the $(MSBuildProjectName) assembly which is used to create, edit, and evaluate MSBuild projects. false full - + $(NoWarn);NU5104 - From 84334e499b0dc9ee691d3b4bbb5863433568b25f Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sat, 8 Jan 2022 10:11:28 +1000 Subject: [PATCH 07/11] Revert CodeAnalysis.ruleset changes --- eng/CodeAnalysis.ruleset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 1821bec9b08..2078c42fe6c 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -54,7 +54,7 @@ - + From 3e028e9ab8ac6e9b88cede963d358e7d85888670 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sat, 8 Jan 2022 10:14:17 +1000 Subject: [PATCH 08/11] enable warning on CA1200 --- eng/Common.globalconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index fd878420d57..005e231941c 100644 --- a/eng/Common.globalconfig +++ b/eng/Common.globalconfig @@ -164,7 +164,7 @@ dotnet_diagnostic.CA1069.severity = none dotnet_diagnostic.CA1070.severity = suggestion # Avoid using cref tags with a prefix -dotnet_diagnostic.CA1200.severity = suggestion +dotnet_diagnostic.CA1200.severity = warning # Do not pass literals as localized parameters dotnet_diagnostic.CA1303.severity = none From d39c90035b50e273488b49ed66a0c8fdebfd51eb Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sat, 8 Jan 2022 13:47:36 +1000 Subject: [PATCH 09/11] Fix remaining occurrences of CA1200 violations --- src/Framework/NativeMethods.cs | 2 +- src/MSBuildTaskHost/Concurrent/ConcurrentDictionary.cs | 10 +++++----- .../RoslynCodeTaskFactory/RoslynCodeTaskFactory.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Framework/NativeMethods.cs b/src/Framework/NativeMethods.cs index 367b4eb6955..aba2bb7c7b7 100644 --- a/src/Framework/NativeMethods.cs +++ b/src/Framework/NativeMethods.cs @@ -258,7 +258,7 @@ protected override bool ReleaseHandle() internal class MemoryStatus { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public MemoryStatus() { diff --git a/src/MSBuildTaskHost/Concurrent/ConcurrentDictionary.cs b/src/MSBuildTaskHost/Concurrent/ConcurrentDictionary.cs index 588c67814f1..a27b5f6dbba 100644 --- a/src/MSBuildTaskHost/Concurrent/ConcurrentDictionary.cs +++ b/src/MSBuildTaskHost/Concurrent/ConcurrentDictionary.cs @@ -269,14 +269,14 @@ private static void ThrowKeyNullException() /// if the key does not already exist. /// /// The key of the element to add. - /// The function used to generate a value for the key - /// is a null reference + /// The function used to generate a value for the key. + /// is a null reference /// (Nothing in Visual Basic). - /// is a null reference + /// is a null reference /// (Nothing in Visual Basic). - /// The dictionary contains too many + /// The dictionary contains too many /// elements. - /// The value for the key. This will be either the existing value for the key if the + /// The value for the key. This will be either the existing value for the key if the /// key is already in the dictionary, or the new value for the key as returned by valueFactory /// if the key was not in the dictionary. public TValue GetOrAdd(TKey key, Func valueFactory) diff --git a/src/Tasks/RoslynCodeTaskFactory/RoslynCodeTaskFactory.cs b/src/Tasks/RoslynCodeTaskFactory/RoslynCodeTaskFactory.cs index d48f5ac697a..94fb0e99137 100644 --- a/src/Tasks/RoslynCodeTaskFactory/RoslynCodeTaskFactory.cs +++ b/src/Tasks/RoslynCodeTaskFactory/RoslynCodeTaskFactory.cs @@ -116,7 +116,7 @@ public sealed class RoslynCodeTaskFactory : ITaskFactory public string FactoryName => "Roslyn Code Task Factory"; /// - /// Gets the of the compiled task. + /// Gets the of the compiled task. /// public Type TaskType { get; private set; } From b96d8bc42bef716b2f407d91ecd7dd3d7684a42c Mon Sep 17 00:00:00 2001 From: Lachlan Ennis <2433737+elachlan@users.noreply.github.com> Date: Tue, 11 Jan 2022 09:33:30 +1000 Subject: [PATCH 10/11] Update src/Build/Definition/ProjectCollection.cs Co-authored-by: Rainer Sigwald --- src/Build/Definition/ProjectCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index 2170cb1d868..2d76ca87e4f 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -434,7 +434,7 @@ public static ProjectCollection GlobalProjectCollection /// This is the Windows file version (specifically the value of the FileVersion /// resource), not necessarily the assembly version. /// If you want the assembly version, use Constants.AssemblyVersion. - /// This is not a . + /// This is not the . /// public static Version Version { From b5b226bbf94f2170ce90e9bb8b56ade55d8ec3b3 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Tue, 11 Jan 2022 09:49:30 +1000 Subject: [PATCH 11/11] Fix spacing issue --- src/Framework/Sdk/SdkResolver.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Framework/Sdk/SdkResolver.cs b/src/Framework/Sdk/SdkResolver.cs index 2cdbdb8ed5b..753cc5a0116 100644 --- a/src/Framework/Sdk/SdkResolver.cs +++ b/src/Framework/Sdk/SdkResolver.cs @@ -28,11 +28,11 @@ public abstract class SdkResolver /// Context for resolving the SDK. /// Factory class to create an /// - /// An containing the resolved SDKs or associated error / reason - /// the SDK could not be resolved. Return if the resolver is not - /// applicable for a particular . - /// - /// + /// An containing the resolved SDKs or associated error / reason + /// the SDK could not be resolved. Return if the resolver is not + /// applicable for a particular . + /// + /// /// Note: You must use to return a result. /// ///