.Builder _itemsToUpdate;
+ private ItemSpecMatchesItem _matchItemSpec;
+ private bool? _needToExpandMetadataForEachItem;
public UpdateOperation(OperationBuilderWithMetadata builder, LazyItemEvaluator lazyEvaluator)
: base(builder, lazyEvaluator)
diff --git a/src/Build/Evaluation/LazyItemEvaluator.cs b/src/Build/Evaluation/LazyItemEvaluator.cs
index 99dc789d996..791c42e9592 100644
--- a/src/Build/Evaluation/LazyItemEvaluator.cs
+++ b/src/Build/Evaluation/LazyItemEvaluator.cs
@@ -34,7 +34,7 @@ internal partial class LazyItemEvaluator
private readonly LoggingContext _loggingContext;
private readonly EvaluationProfiler _evaluationProfiler;
- private int _nextElementOrder = 0;
+ private int _nextElementOrder;
private Dictionary _itemLists = Traits.Instance.EscapeHatches.UseCaseSensitiveItemNames ?
new Dictionary() :
diff --git a/src/Build/Instance/HostServices.cs b/src/Build/Instance/HostServices.cs
index a27e5787cfb..064ae4a50d7 100644
--- a/src/Build/Instance/HostServices.cs
+++ b/src/Build/Instance/HostServices.cs
@@ -384,8 +384,8 @@ internal class MonikerNameOrITaskHost
{
public ITaskHost TaskHost { get; }
public string MonikerName { get; }
- public bool IsTaskHost { get; } = false;
- public bool IsMoniker { get; } = false;
+ public bool IsTaskHost { get; }
+ public bool IsMoniker { get; }
public MonikerNameOrITaskHost(ITaskHost taskHost)
{
TaskHost = taskHost;
diff --git a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs
index 4596be57f52..88265e4e242 100644
--- a/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs
+++ b/src/Build/Instance/TaskFactories/AssemblyTaskFactory.cs
@@ -31,7 +31,7 @@ internal class AssemblyTaskFactory : ITaskFactory2
///
/// Name of the task wrapped by the task factory
///
- private string _taskName = null;
+ private string _taskName;
///
/// The loaded type (type, assembly name / file) of the task wrapped by the factory
diff --git a/src/Build/Instance/TaskFactories/TaskHostTask.cs b/src/Build/Instance/TaskFactories/TaskHostTask.cs
index 99bc7663895..d489b8feaa4 100644
--- a/src/Build/Instance/TaskFactories/TaskHostTask.cs
+++ b/src/Build/Instance/TaskFactories/TaskHostTask.cs
@@ -91,7 +91,7 @@ internal class TaskHostTask : IGeneratedTask, ICancelableTask, INodePacketFactor
///
/// True if currently connected to the task host; false otherwise.
///
- private bool _connectedToTaskHost = false;
+ private bool _connectedToTaskHost;
///
/// The provider for task host nodes.
@@ -117,7 +117,7 @@ internal class TaskHostTask : IGeneratedTask, ICancelableTask, INodePacketFactor
///
/// Did the task succeed?
///
- private bool _taskExecutionSucceeded = false;
+ private bool _taskExecutionSucceeded;
///
/// Constructor
diff --git a/src/Build/Logging/BaseConsoleLogger.cs b/src/Build/Logging/BaseConsoleLogger.cs
index 1f7480ffc0c..8ff3d28b728 100644
--- a/src/Build/Logging/BaseConsoleLogger.cs
+++ b/src/Build/Logging/BaseConsoleLogger.cs
@@ -75,14 +75,14 @@ internal static ConsoleColor BackgroundColor
/// and warnings summary at the end of a build.
///
/// null
- public string Parameters { get; set; } = null;
+ public string Parameters { get; set; }
///
/// Suppresses the display of project headers. Project headers are
/// displayed by default unless this property is set.
///
/// This is only needed by the IDE logger.
- internal bool SkipProjectStartedText { get; set; } = false;
+ internal bool SkipProjectStartedText { get; set; }
///
/// Suppresses the display of error and warnings summary.
@@ -1148,12 +1148,12 @@ private bool ApplyVerbosityParameter(string parameterValue)
///
/// Delegate used to change text color.
///
- internal ColorSetter setColor = null;
+ internal ColorSetter setColor;
///
/// Delegate used to reset text color
///
- internal ColorResetter resetColor = null;
+ internal ColorResetter resetColor;
///
/// Number of spaces that each level of indentation is worth
@@ -1163,7 +1163,7 @@ private bool ApplyVerbosityParameter(string parameterValue)
///
/// Keeps track of the current indentation level.
///
- internal int currentIndentLevel = 0;
+ internal int currentIndentLevel;
///
/// The kinds of newline breaks we expect.
@@ -1190,7 +1190,7 @@ private bool ApplyVerbosityParameter(string parameterValue)
///
/// When true, accumulate performance numbers.
///
- internal bool showPerfSummary = false;
+ internal bool showPerfSummary;
///
/// When true, show the list of item and property values at the start of each project
@@ -1200,7 +1200,7 @@ private bool ApplyVerbosityParameter(string parameterValue)
///
/// Should the target output items be displayed
///
- internal bool showTargetOutputs = false;
+ internal bool showTargetOutputs;
///
/// When true, suppresses all messages except for warnings. (And possibly errors, if showOnlyErrors is true.)
@@ -1220,23 +1220,23 @@ private bool ApplyVerbosityParameter(string parameterValue)
///
/// When true, indicates that the logger should tack the project file onto the end of errors and warnings.
///
- protected bool showProjectFile = false;
+ protected bool showProjectFile;
internal bool ignoreLoggerErrors = true;
- internal bool runningWithCharacterFileType = false;
+ internal bool runningWithCharacterFileType;
#region Per-build Members
///
/// Number of errors encountered in this build
///
- internal int errorCount = 0;
+ internal int errorCount;
///
/// Number of warnings encountered in this build
///
- internal int warningCount = 0;
+ internal int warningCount;
///
/// A list of the errors that have occurred during this build.
diff --git a/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs b/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs
index c6be1d59db3..371df743324 100644
--- a/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs
+++ b/src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs
@@ -22,7 +22,7 @@ public class BuildEventArgsReader : IDisposable
{
private readonly BinaryReader binaryReader;
private readonly int fileFormatVersion;
- private long recordNumber = 0;
+ private long recordNumber;
///
/// A list of string records we've encountered so far. If it's a small string, it will be the string directly.
@@ -1291,7 +1291,7 @@ public StringStorage()
}
}
- private long totalAllocatedShortStrings = 0;
+ private long totalAllocatedShortStrings;
public object Add(string text)
{
diff --git a/src/Build/Logging/ConsoleLogger.cs b/src/Build/Logging/ConsoleLogger.cs
index c6358a9badb..d1f3409fe4b 100644
--- a/src/Build/Logging/ConsoleLogger.cs
+++ b/src/Build/Logging/ConsoleLogger.cs
@@ -50,7 +50,7 @@ public class ConsoleLogger : INodeLogger
private ColorSetter _colorSet;
private ColorResetter _colorReset;
private string _parameters;
- private bool _skipProjectStartedText = false;
+ private bool _skipProjectStartedText;
private bool? _showSummary;
#region Constructors
diff --git a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs
index 83c2499aefa..9bddd0f5028 100644
--- a/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs
+++ b/src/Build/Logging/DistributedLoggers/ConfigurableForwardingLogger.cs
@@ -512,7 +512,7 @@ private bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity)
///
/// Console logger parameters.
///
- private string _loggerParameters = null;
+ private string _loggerParameters;
///
/// Console logger parameters delimiters.
@@ -572,12 +572,12 @@ private bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity)
///
/// When true, accumulate performance numbers.
///
- private bool _showPerfSummary = false;
+ private bool _showPerfSummary;
///
/// When true the commandline message is sent
///
- private bool _showCommandLine = false;
+ private bool _showCommandLine;
///
/// Id of the node the logger is attached to
diff --git a/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs b/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs
index a68b477bfdc..598f8e5315e 100644
--- a/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs
+++ b/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs
@@ -1769,7 +1769,7 @@ internal override void PrintCounterMessage(WriteLinePrettyFromResourceDelegate W
private BuildEventContext _lastDisplayedBuildEventContext;
private int _bufferWidth = -1;
private readonly object _lockObject = new Object();
- private int _prefixWidth = 0;
+ private int _prefixWidth;
private ProjectFullKey _lastProjectFullKey = new ProjectFullKey(-1, -1);
private bool _alignMessages;
private bool _forceNoAlign;
diff --git a/src/Build/Logging/ProfilerLogger.cs b/src/Build/Logging/ProfilerLogger.cs
index 5d0ed444b07..9c0542b3def 100644
--- a/src/Build/Logging/ProfilerLogger.cs
+++ b/src/Build/Logging/ProfilerLogger.cs
@@ -29,7 +29,7 @@ public sealed class ProfilerLogger : ILogger
///
/// Aggregation of all profiled locations. Computed the first time is called.
///
- private Dictionary _aggregatedLocations = null;
+ private Dictionary _aggregatedLocations;
///
/// If null, no file is saved to disk
From 7a16522ebb4c6d33cc935b5e5ddf53b6da44e31a Mon Sep 17 00:00:00 2001
From: elachlan <2433737+elachlan@users.noreply.github.com>
Date: Thu, 30 Dec 2021 11:39:57 +1000
Subject: [PATCH 4/8] Wrap debug variables instead of not assigning them
---
.../Helpers/ViewValidation.construction.cs | 4 +++-
.../RemoteProjectsProviderMock/ExporterMock.cs | 10 +++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/Build.OM.UnitTests/ObjectModelRemoting/Helpers/ViewValidation.construction.cs b/src/Build.OM.UnitTests/ObjectModelRemoting/Helpers/ViewValidation.construction.cs
index a2a66e2e8d4..92b2b07e215 100644
--- a/src/Build.OM.UnitTests/ObjectModelRemoting/Helpers/ViewValidation.construction.cs
+++ b/src/Build.OM.UnitTests/ObjectModelRemoting/Helpers/ViewValidation.construction.cs
@@ -265,7 +265,9 @@ public static bool IsLinkedObject(object obj)
return LinkedObjectsFactory.GetLink(obj) != null;
}
- private static bool dbgIgnoreLinked;
+#pragma warning disable CA1805 // Do not initialize unnecessarily
+ private static bool dbgIgnoreLinked = false;
+#pragma warning restore CA1805 // Do not initialize unnecessarily
public static void VerifyNotLinked(object obj)
{
if (dbgIgnoreLinked) return;
diff --git a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs
index f25c3e4149e..ba98efe7e64 100644
--- a/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs
+++ b/src/Build.OM.UnitTests/ObjectModelRemoting/RemoteProjectsProviderMock/ExporterMock.cs
@@ -1,5 +1,4 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Build.UnitTests.OM.ObjectModelRemoting
{
@@ -214,10 +213,11 @@ private void ConnectTo (ProjectCollectionLinker other)
}
}
- private static bool dbgValidateDuplicateViews;
+#pragma warning disable CA1805 // Do not initialize unnecessarily
+ private static bool dbgValidateDuplicateViews = false;
+#pragma warning restore CA1805 // Do not initialize unnecessarily
-
- internal void ValidateNoDuplicates()
+ internal void ValidateNoDuplicates()
{
foreach (var r in imported)
{
From 4456c622716f62c90e0f0ebc4915ef60ab870826 Mon Sep 17 00:00:00 2001
From: elachlan <2433737+elachlan@users.noreply.github.com>
Date: Thu, 30 Dec 2021 11:46:15 +1000
Subject: [PATCH 5/8] Fix CS0649 warning
---
.../AssemblyDependency/ResolveAssemblyReferenceTestFixture.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Tasks.UnitTests/AssemblyDependency/ResolveAssemblyReferenceTestFixture.cs b/src/Tasks.UnitTests/AssemblyDependency/ResolveAssemblyReferenceTestFixture.cs
index 26c35c99ff0..428b4705511 100644
--- a/src/Tasks.UnitTests/AssemblyDependency/ResolveAssemblyReferenceTestFixture.cs
+++ b/src/Tasks.UnitTests/AssemblyDependency/ResolveAssemblyReferenceTestFixture.cs
@@ -44,7 +44,7 @@ public class ResolveAssemblyReferenceTestFixture : IDisposable
internal static Dictionary uniqueFileExists;
internal static Dictionary uniqueGetAssemblyName;
- internal static bool useFrameworkFileExists;
+ internal static bool useFrameworkFileExists { get; set; }
internal const string REDISTLIST = @"
From d01f99bd7c834863fbdb93dba0c61956da176c8b Mon Sep 17 00:00:00 2001
From: elachlan <2433737+elachlan@users.noreply.github.com>
Date: Sat, 8 Jan 2022 10:20:39 +1000
Subject: [PATCH 6/8] Revert CodeAnalysis.ruleset
---
eng/CodeAnalysis.ruleset | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset
index 989f3de33d1..2078c42fe6c 100644
--- a/eng/CodeAnalysis.ruleset
+++ b/eng/CodeAnalysis.ruleset
@@ -83,7 +83,7 @@
-
+
From 8bc5f6741c5e9f29142eb15184c28441174a38b1 Mon Sep 17 00:00:00 2001
From: elachlan <2433737+elachlan@users.noreply.github.com>
Date: Sat, 8 Jan 2022 10:21:17 +1000
Subject: [PATCH 7/8] enable warning on CA1805
---
eng/Common.globalconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig
index fd878420d57..a15b89db538 100644
--- a/eng/Common.globalconfig
+++ b/eng/Common.globalconfig
@@ -248,7 +248,7 @@ dotnet_diagnostic.CA1801.severity = none
dotnet_diagnostic.CA1802.severity = suggestion
# Do not initialize unnecessarily
-dotnet_diagnostic.CA1805.severity = suggestion
+dotnet_diagnostic.CA1805.severity = warning
dotnet_diagnostic.CA1806.severity = none
From 1804a8a8a295375ecbd55a2b24183e99fe5c2d1f Mon Sep 17 00:00:00 2001
From: elachlan <2433737+elachlan@users.noreply.github.com>
Date: Sat, 8 Jan 2022 12:43:16 +1000
Subject: [PATCH 8/8] Fix remaining occurrences of CA1805 violations
---
.../Definition/ToolsetReader_Tests.cs | 8 ++--
.../Definition/ToolsetRegistryReader_Tests.cs | 6 +--
.../Evaluation/Evaluator_Tests.cs | 2 +-
src/Build/Definition/Toolset.cs | 2 +-
src/Build/Utilities/RegistryKeyWrapper.cs | 2 +-
src/Framework/BuildEnvironmentState.cs | 4 +-
src/Framework/TaskPropertyInfo.cs | 2 +-
src/Framework/TestInfo.cs | 2 +-
src/Framework/Traits.cs | 2 +-
.../LanguageParser/CSharptokenEnumerator.cs | 2 +-
src/Shared/LanguageParser/CSharptokenizer.cs | 4 +-
.../LanguageParser/StreamMappedString.cs | 10 ++---
.../VisualBasictokenEnumerator.cs | 2 +-
.../LanguageParser/VisualBasictokenizer.cs | 2 +-
src/Shared/LanguageParser/token.cs | 4 +-
src/Shared/LanguageParser/tokenEnumerator.cs | 2 +-
.../GlobalAssemblyCacheTests.cs | 2 +-
.../SdkToolsPathUtility_Tests.cs | 8 ++--
src/Tasks.UnitTests/XamlTestHelpers.cs | 2 +-
src/Tasks/AssemblyDependency/Reference.cs | 20 ++++-----
.../ResolveAssemblyReference.cs | 26 ++++++------
src/Tasks/AssignProjectConfiguration.cs | 4 +-
src/Tasks/AxTlbBaseTask.cs | 2 +-
src/Tasks/BootstrapperUtil/BuildSettings.cs | 2 +-
src/Tasks/CallTarget.cs | 2 +-
src/Tasks/CodeTaskFactory.cs | 2 +-
.../CombineTargetFrameworkInfoProperties.cs | 2 +-
src/Tasks/CreateItem.cs | 2 +-
src/Tasks/CreateManifestResourceName.cs | 2 +-
src/Tasks/Delete.cs | 2 +-
src/Tasks/DependencyFile.cs | 2 +-
src/Tasks/GenerateDeploymentManifest.cs | 4 +-
src/Tasks/GenerateManifestBase.cs | 4 +-
src/Tasks/GenerateResource.cs | 42 +++++++++----------
src/Tasks/ManifestUtil/AssemblyReference.cs | 6 +--
src/Tasks/ManifestUtil/mansign2.cs | 34 +++++++--------
src/Tasks/ResolveKeySource.cs | 4 +-
src/Tasks/ResolveManifestFiles.cs | 6 +--
src/Tasks/System.Design.cs | 4 +-
src/Tasks/XamlTaskFactory/XamlTaskFactory.cs | 2 +-
src/Utilities/ToolLocationHelper.cs | 2 +-
src/Utilities/ToolTask.cs | 6 +--
42 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/src/Build.UnitTests/Definition/ToolsetReader_Tests.cs b/src/Build.UnitTests/Definition/ToolsetReader_Tests.cs
index e1c99c40e33..bd422f2ed49 100644
--- a/src/Build.UnitTests/Definition/ToolsetReader_Tests.cs
+++ b/src/Build.UnitTests/Definition/ToolsetReader_Tests.cs
@@ -34,11 +34,11 @@ namespace Microsoft.Build.UnitTests.Definition
public class ToolsetReaderTests : IDisposable
{
// The registry key that is passed as the baseKey parameter to the ToolsetRegistryReader class
- private RegistryKey _testRegistryKey = null;
+ private RegistryKey _testRegistryKey;
// Subkey "4.0"
- private RegistryKey _currentVersionRegistryKey = null;
+ private RegistryKey _currentVersionRegistryKey;
// Subkey "ToolsVersions"
- private RegistryKey _toolsVersionsRegistryKey = null;
+ private RegistryKey _toolsVersionsRegistryKey;
// Path to the registry key under HKCU
// Note that this is a test registry key created solely for unit testing.
@@ -2868,7 +2868,7 @@ public enum WhereToThrow
}
private WhereToThrow _whereToThrow = WhereToThrow.None;
- private string _subKeyThatDoesNotExist = null;
+ private string _subKeyThatDoesNotExist;
///
/// Construct the mock key with a specified key
diff --git a/src/Build.UnitTests/Definition/ToolsetRegistryReader_Tests.cs b/src/Build.UnitTests/Definition/ToolsetRegistryReader_Tests.cs
index 38a7a917f76..8b682854959 100644
--- a/src/Build.UnitTests/Definition/ToolsetRegistryReader_Tests.cs
+++ b/src/Build.UnitTests/Definition/ToolsetRegistryReader_Tests.cs
@@ -27,11 +27,11 @@ namespace Microsoft.Build.UnitTests.Definition
public class ToolsetRegistryReader_Tests : IDisposable
{
// The registry key that is passed as the baseKey parameter to the ToolsetRegistryReader class
- private RegistryKey _testRegistryKey = null;
+ private RegistryKey _testRegistryKey;
// Subkey "3.5"
- private RegistryKey _currentVersionRegistryKey = null;
+ private RegistryKey _currentVersionRegistryKey;
// Subkey "ToolsVersions"
- private RegistryKey _toolsVersionsRegistryKey = null;
+ private RegistryKey _toolsVersionsRegistryKey;
// Path to the registry key under HKCU
// Note that this is a test registry key created solely for unit testing.
diff --git a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs
index 0ac654bcb3a..c95ec9b89ff 100644
--- a/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs
+++ b/src/Build.UnitTests/Evaluation/Evaluator_Tests.cs
@@ -4234,7 +4234,7 @@ public void VerifyDTDProcessingIsDisabled()
}
#if FEATURE_HTTP_LISTENER
- private Exception _httpListenerThreadException = null;
+ private Exception _httpListenerThreadException;
///
/// Verify that DTD processing is disabled when loading a project
diff --git a/src/Build/Definition/Toolset.cs b/src/Build/Definition/Toolset.cs
index 6cf6dfeaef7..02c5cfdb530 100644
--- a/src/Build/Definition/Toolset.cs
+++ b/src/Build/Definition/Toolset.cs
@@ -110,7 +110,7 @@ public class Toolset : ITranslatable
/// Null if it hasn't been figured out yet; true if (some variation of) Visual Studio 2010 is installed on
/// the current machine, false otherwise.
///
- private static bool? s_dev10IsInstalled = null;
+ private static bool? s_dev10IsInstalled;
#endif // FEATURE_WIN32_REGISTRY
///
diff --git a/src/Build/Utilities/RegistryKeyWrapper.cs b/src/Build/Utilities/RegistryKeyWrapper.cs
index 3257b6eb229..f77d484629b 100644
--- a/src/Build/Utilities/RegistryKeyWrapper.cs
+++ b/src/Build/Utilities/RegistryKeyWrapper.cs
@@ -25,7 +25,7 @@ internal class RegistryKeyWrapper : IDisposable
// The hive this registry key lives under
private RegistryKey _registryHive;
// This field will be set to true when we try to open the registry key
- private bool _attemptedToOpenRegistryKey = false;
+ private bool _attemptedToOpenRegistryKey;
///
/// Has the object been disposed yet.
diff --git a/src/Framework/BuildEnvironmentState.cs b/src/Framework/BuildEnvironmentState.cs
index 9743b2a5eab..2746ce3c9f0 100644
--- a/src/Framework/BuildEnvironmentState.cs
+++ b/src/Framework/BuildEnvironmentState.cs
@@ -13,7 +13,7 @@ namespace Microsoft.Build.Framework
///
internal static class BuildEnvironmentState
{
- internal static bool s_runningInVisualStudio = false;
- internal static bool s_runningTests = false;
+ internal static bool s_runningInVisualStudio;
+ internal static bool s_runningTests;
}
}
diff --git a/src/Framework/TaskPropertyInfo.cs b/src/Framework/TaskPropertyInfo.cs
index 449354b5e43..b52537cd4a4 100644
--- a/src/Framework/TaskPropertyInfo.cs
+++ b/src/Framework/TaskPropertyInfo.cs
@@ -61,6 +61,6 @@ public TaskPropertyInfo(string name, Type typeOfParameter, bool output, bool req
///
/// Whether the Log and LogItemMetadata properties have been assigned already.
///
- internal bool Initialized = false;
+ internal bool Initialized;
}
}
diff --git a/src/Framework/TestInfo.cs b/src/Framework/TestInfo.cs
index 48c47b52296..a9fe09de258 100644
--- a/src/Framework/TestInfo.cs
+++ b/src/Framework/TestInfo.cs
@@ -12,6 +12,6 @@ namespace Microsoft.Build.Framework
// which are compiled into multiple projects.
internal static class TestInfo
{
- public static bool s_runningTests = false;
+ public static bool s_runningTests;
}
}
diff --git a/src/Framework/Traits.cs b/src/Framework/Traits.cs
index ddcb8ade1ed..c38188ec71e 100644
--- a/src/Framework/Traits.cs
+++ b/src/Framework/Traits.cs
@@ -195,7 +195,7 @@ public bool LogTaskInputs
}
private bool? _logPropertiesAndItemsAfterEvaluation;
- private bool _logPropertiesAndItemsAfterEvaluationInitialized = false;
+ private bool _logPropertiesAndItemsAfterEvaluationInitialized;
public bool? LogPropertiesAndItemsAfterEvaluation
{
get
diff --git a/src/Shared/LanguageParser/CSharptokenEnumerator.cs b/src/Shared/LanguageParser/CSharptokenEnumerator.cs
index 6cd1204c112..ab1c7152418 100644
--- a/src/Shared/LanguageParser/CSharptokenEnumerator.cs
+++ b/src/Shared/LanguageParser/CSharptokenEnumerator.cs
@@ -18,7 +18,7 @@ namespace Microsoft.Build.Shared.LanguageParser
sealed internal class CSharpTokenEnumerator : TokenEnumerator
{
// Reader over the sources.
- private CSharpTokenCharReader _reader = null;
+ private CSharpTokenCharReader _reader;
/*
* Method: TokenEnumerator
diff --git a/src/Shared/LanguageParser/CSharptokenizer.cs b/src/Shared/LanguageParser/CSharptokenizer.cs
index eedeedd05a8..b947bbb38f3 100644
--- a/src/Shared/LanguageParser/CSharptokenizer.cs
+++ b/src/Shared/LanguageParser/CSharptokenizer.cs
@@ -33,10 +33,10 @@ internal class OpenScopeToken : OperatorOrPunctuatorToken { } // i.e. "{"
internal class CloseScopeToken : OperatorOrPunctuatorToken { } // i.e. "}"
// The source lines
- private Stream _binaryStream = null;
+ private Stream _binaryStream;
// Whether to force ANSI or not.
- private bool _forceANSI = false;
+ private bool _forceANSI;
///
/// Construct.
diff --git a/src/Shared/LanguageParser/StreamMappedString.cs b/src/Shared/LanguageParser/StreamMappedString.cs
index f8fda805458..80abe309153 100644
--- a/src/Shared/LanguageParser/StreamMappedString.cs
+++ b/src/Shared/LanguageParser/StreamMappedString.cs
@@ -43,27 +43,27 @@ sealed internal class StreamMappedString
///
/// The number of characters read into currentPage.
///
- private int _charactersRead = 0;
+ private int _charactersRead;
///
/// The page before currentPage.
///
- private char[] _priorPage = null;
+ private char[] _priorPage;
///
/// The most recently read page.
///
- private char[] _currentPage = null;
+ private char[] _currentPage;
///
/// Count of the total number of pages allocated.
///
- private int _pagesAllocated = 0;
+ private int _pagesAllocated;
///
/// Size of pages to use for reading from source file.
///
- private int _pageSize = 0;
+ private int _pageSize;
///
/// Construct.
diff --git a/src/Shared/LanguageParser/VisualBasictokenEnumerator.cs b/src/Shared/LanguageParser/VisualBasictokenEnumerator.cs
index 3fbc3b0ed4b..7d65256e2f6 100644
--- a/src/Shared/LanguageParser/VisualBasictokenEnumerator.cs
+++ b/src/Shared/LanguageParser/VisualBasictokenEnumerator.cs
@@ -17,7 +17,7 @@ namespace Microsoft.Build.Shared.LanguageParser
sealed internal class VisualBasicTokenEnumerator : TokenEnumerator
{
// Reader over the sources.
- private VisualBasicTokenCharReader _reader = null;
+ private VisualBasicTokenCharReader _reader;
/*
* Method: TokenEnumerator
diff --git a/src/Shared/LanguageParser/VisualBasictokenizer.cs b/src/Shared/LanguageParser/VisualBasictokenizer.cs
index 3dfff889a24..262e764fd83 100644
--- a/src/Shared/LanguageParser/VisualBasictokenizer.cs
+++ b/src/Shared/LanguageParser/VisualBasictokenizer.cs
@@ -31,7 +31,7 @@ internal class OctalIntegerLiteralToken : IntegerLiteralToken { }
internal class ExpectedValidOctalDigitToken : SyntaxErrorToken { }
// The source lines
- private Stream _binaryStream = null;
+ private Stream _binaryStream;
// Whether or not to force ANSI reading.
private bool _forceANSI;
diff --git a/src/Shared/LanguageParser/token.cs b/src/Shared/LanguageParser/token.cs
index 2322048c796..e079a6a9dd5 100644
--- a/src/Shared/LanguageParser/token.cs
+++ b/src/Shared/LanguageParser/token.cs
@@ -16,9 +16,9 @@ namespace Microsoft.Build.Shared.LanguageParser
internal abstract class Token
{
// The text from the originating source file that caused this token.
- private string _innerText = null;
+ private string _innerText;
// The line number that the token fell on.
- private int _line = 0;
+ private int _line;
/*
* Method: InnerText
diff --git a/src/Shared/LanguageParser/tokenEnumerator.cs b/src/Shared/LanguageParser/tokenEnumerator.cs
index 8c691dcb8b8..9c10b46cc18 100644
--- a/src/Shared/LanguageParser/tokenEnumerator.cs
+++ b/src/Shared/LanguageParser/tokenEnumerator.cs
@@ -17,7 +17,7 @@ namespace Microsoft.Build.Shared.LanguageParser
internal abstract class TokenEnumerator : IEnumerator
{
// The current token that was found.
- protected Token current = null;
+ protected Token current;
// Return the token char reader.
abstract internal TokenCharReader Reader { get; }
diff --git a/src/Tasks.UnitTests/AssemblyDependency/GlobalAssemblyCacheTests.cs b/src/Tasks.UnitTests/AssemblyDependency/GlobalAssemblyCacheTests.cs
index 276cb4ed9f6..d2e5cbf9a70 100644
--- a/src/Tasks.UnitTests/AssemblyDependency/GlobalAssemblyCacheTests.cs
+++ b/src/Tasks.UnitTests/AssemblyDependency/GlobalAssemblyCacheTests.cs
@@ -958,7 +958,7 @@ private static IEnumerable MockAssemblyCacheEnumerator(st
internal class MockEnumerator : IEnumerable
{
- private List _assembliesToEnumerate = null;
+ private List _assembliesToEnumerate;
private List.Enumerator _enumerator;
public MockEnumerator(List assembliesToEnumerate)
diff --git a/src/Tasks.UnitTests/SdkToolsPathUtility_Tests.cs b/src/Tasks.UnitTests/SdkToolsPathUtility_Tests.cs
index 454e37ac408..0ad7fb36181 100644
--- a/src/Tasks.UnitTests/SdkToolsPathUtility_Tests.cs
+++ b/src/Tasks.UnitTests/SdkToolsPathUtility_Tests.cs
@@ -15,10 +15,10 @@ namespace Microsoft.Build.UnitTests
sealed public class SdkToolsPathUtility_Tests
{
private string _defaultSdkToolsPath = NativeMethodsShared.IsWindows ? "C:\\ProgramFiles\\WIndowsSDK\\bin" : "/ProgramFiles/WindowsSDK/bin";
- private TaskLoggingHelper _log = null;
+ private TaskLoggingHelper _log;
private string _toolName = "MyTool.exe";
- private MockEngine _mockEngine = null;
- private MockFileExists _mockExists = null;
+ private MockEngine _mockEngine;
+ private MockFileExists _mockExists;
public SdkToolsPathUtility_Tests()
{
@@ -236,7 +236,7 @@ internal class MockFileExists
///
/// Path to the x86 sdk tools location
///
- private string _sdkToolsPath = null;
+ private string _sdkToolsPath;
#endregion
#region Constructor
diff --git a/src/Tasks.UnitTests/XamlTestHelpers.cs b/src/Tasks.UnitTests/XamlTestHelpers.cs
index 052fe764616..d4d6d734f0a 100644
--- a/src/Tasks.UnitTests/XamlTestHelpers.cs
+++ b/src/Tasks.UnitTests/XamlTestHelpers.cs
@@ -87,7 +87,7 @@ internal static class XamlTestHelpers
";
- private static string s_pathToMSBuildBinaries = null;
+ private static string s_pathToMSBuildBinaries;
///
/// Returns the path to the MSBuild binaries
diff --git a/src/Tasks/AssemblyDependency/Reference.cs b/src/Tasks/AssemblyDependency/Reference.cs
index 015ff467546..60990c3011d 100644
--- a/src/Tasks/AssemblyDependency/Reference.cs
+++ b/src/Tasks/AssemblyDependency/Reference.cs
@@ -318,18 +318,18 @@ internal string[] GetExecutableExtensions(string[] allowedAssemblyExtensions)
/// Whether types need to be embedded into the target assembly
///
///
- internal bool EmbedInteropTypes { get; set; } = false;
+ internal bool EmbedInteropTypes { get; set; }
///
/// This will be true if the user requested a specific file. We know this when the file was resolved
/// by hintpath or if it was resolve as a raw file name for example.
///
- internal bool UserRequestedSpecificFile { get; set; } = false;
+ internal bool UserRequestedSpecificFile { get; set; }
///
/// The version number of this reference
///
- internal Version ReferenceVersion { get; set; } = null;
+ internal Version ReferenceVersion { get; set; }
///
/// True if the assembly was found to be in the GAC.
@@ -589,22 +589,22 @@ internal string FullPathWithoutExtension
/// through the reference resolution process.
///
/// 'true' if this reference is a primary assembly.
- internal bool IsPrimary { get; private set; } = false;
+ internal bool IsPrimary { get; private set; }
///
/// Whether or not this reference will be installed on the target machine.
///
- internal bool IsPrerequisite { set; get; } = false;
+ internal bool IsPrerequisite { set; get; }
///
/// Whether or not this reference is a redist root.
///
- internal bool? IsRedistRoot { set; get; } = null;
+ internal bool? IsRedistRoot { set; get; }
///
/// The redist name for this reference (if any)
///
- internal string RedistName { set; get; } = null;
+ internal string RedistName { set; get; }
///
/// The original source item, as passed into the task that is directly associated
@@ -628,7 +628,7 @@ internal ITaskItem PrimarySourceItem
/// This item shouldn't be passed to compilers and so forth.
///
/// 'true' if this reference points to a bad image.
- internal bool IsBadImage { get; private set; } = false;
+ internal bool IsBadImage { get; private set; }
///
/// If true, then this item conflicted with another item and lost.
@@ -660,7 +660,7 @@ internal List GetConflictVictims()
///
/// The name of the assembly that won over this reference.
///
- internal AssemblyNameExtension ConflictVictorName { get; set; } = null;
+ internal AssemblyNameExtension ConflictVictorName { get; set; }
///
/// The reason why this reference lost to another reference.
@@ -799,7 +799,7 @@ internal bool IsUnresolvable
///
/// Whether or not we still need to find dependencies for this reference.
///
- internal bool DependenciesFound { get; set; } = false;
+ internal bool DependenciesFound { get; set; }
///
/// If the reference has an SDK name metadata this will contain that string.
diff --git a/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs b/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
index 470d064f9ce..589ce02dbb6 100644
--- a/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
+++ b/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
@@ -51,7 +51,7 @@ public class ResolveAssemblyReference : TaskExtension
///
/// Cache of system state information, used to optimize performance.
///
- internal SystemState _cache = null;
+ internal SystemState _cache;
///
/// Construct
@@ -103,7 +103,7 @@ private static class Strings
public static string UnifiedDependency;
public static string UnifiedPrimaryReference;
- private static bool initialized = false;
+ private static bool initialized;
internal static void Initialize(TaskLoggingHelper log)
{
@@ -163,18 +163,18 @@ internal static void Initialize(TaskLoggingHelper log)
private ITaskItem[] _installedAssemblySubsetTables = Array.Empty();
private ITaskItem[] _fullFrameworkAssemblyTables = Array.Empty();
private ITaskItem[] _resolvedSDKReferences = Array.Empty();
- private bool _ignoreDefaultInstalledAssemblyTables = false;
- private bool _ignoreDefaultInstalledAssemblySubsetTables = false;
+ private bool _ignoreDefaultInstalledAssemblyTables;
+ private bool _ignoreDefaultInstalledAssemblySubsetTables;
private string[] _candidateAssemblyFiles = Array.Empty();
private string[] _targetFrameworkDirectories = Array.Empty();
private string[] _searchPaths = Array.Empty();
private string[] _allowedAssemblyExtensions = new string[] { ".winmd", ".dll", ".exe" };
private string[] _relatedFileExtensions = new string[] { ".pdb", ".xml", ".pri" };
- private string _appConfigFile = null;
+ private string _appConfigFile;
private bool _supportsBindingRedirectGeneration;
- private bool _autoUnify = false;
- private bool _ignoreVersionForFrameworkReferences = false;
- private bool _ignoreTargetFrameworkAttributeVersionMismatch = false;
+ private bool _autoUnify;
+ private bool _ignoreVersionForFrameworkReferences;
+ private bool _ignoreTargetFrameworkAttributeVersionMismatch;
private ITaskItem[] _resolvedFiles = Array.Empty();
private ITaskItem[] _resolvedDependencyFiles = Array.Empty();
private ITaskItem[] _relatedFiles = Array.Empty();
@@ -192,22 +192,22 @@ internal static void Initialize(TaskLoggingHelper log)
private bool _findSatellites = true;
private bool _findSerializationAssemblies = true;
private bool _findRelatedFiles = true;
- private bool _silent = false;
+ private bool _silent;
private string _projectTargetFrameworkAsString = String.Empty;
private string _targetedRuntimeVersionRawValue = String.Empty;
private Version _projectTargetFramework;
- private string _stateFile = null;
- private string _targetProcessorArchitecture = null;
+ private string _stateFile;
+ private string _targetProcessorArchitecture;
private string _profileName = String.Empty;
private string[] _fullFrameworkFolders = Array.Empty();
private string[] _latestTargetFrameworkDirectories = Array.Empty();
private bool _copyLocalDependenciesWhenParentReferenceInGac = true;
private Dictionary _showAssemblyFoldersExLocations = new Dictionary(StringComparer.OrdinalIgnoreCase);
- private bool _logVerboseSearchResults = false;
+ private bool _logVerboseSearchResults;
private WarnOrErrorOnTargetArchitectureMismatchBehavior _warnOrErrorOnTargetArchitectureMismatch = WarnOrErrorOnTargetArchitectureMismatchBehavior.Warning;
- private bool _unresolveFrameworkAssembliesFromHigherFrameworks = false;
+ private bool _unresolveFrameworkAssembliesFromHigherFrameworks;
///
/// If set to true, it forces to unresolve framework assemblies with versions higher or equal the version of the target framework, regardless of the target framework
diff --git a/src/Tasks/AssignProjectConfiguration.cs b/src/Tasks/AssignProjectConfiguration.cs
index 1f93054af17..639d5094a0b 100644
--- a/src/Tasks/AssignProjectConfiguration.cs
+++ b/src/Tasks/AssignProjectConfiguration.cs
@@ -112,7 +112,7 @@ public string VcxToDefaultPlatformMapping
///
/// Should we build references even if they were disabled in the project configuration
///
- public bool OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration { get; set; } = false;
+ public bool OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration { get; set; }
// Whether to set the project reference's GlobalPropertiesToRemove metadata to contain
// Configuration and Platform.
@@ -122,7 +122,7 @@ public string VcxToDefaultPlatformMapping
/// on an MSBuild call, the Configuration and Platform metadata will be unset, allowing the
/// child project to build in its default configuration / platform.
///
- public bool ShouldUnsetParentConfigurationAndPlatform { get; set; } = false;
+ public bool ShouldUnsetParentConfigurationAndPlatform { get; set; }
///
/// The output type for the project
diff --git a/src/Tasks/AxTlbBaseTask.cs b/src/Tasks/AxTlbBaseTask.cs
index a6bde0f4930..f533386777d 100644
--- a/src/Tasks/AxTlbBaseTask.cs
+++ b/src/Tasks/AxTlbBaseTask.cs
@@ -71,7 +71,7 @@ public string SdkToolsPath
/// executable, so return null for the ToolName -- And make sure that
/// Execute() logs an error!
///
- protected override string ToolName { get; } = null;
+ protected override string ToolName { get; }
///
/// Invokes the ToolTask with the given parameters
diff --git a/src/Tasks/BootstrapperUtil/BuildSettings.cs b/src/Tasks/BootstrapperUtil/BuildSettings.cs
index 1bbc9f6185a..db48a858d32 100644
--- a/src/Tasks/BootstrapperUtil/BuildSettings.cs
+++ b/src/Tasks/BootstrapperUtil/BuildSettings.cs
@@ -66,7 +66,7 @@ public BuildSettings()
///
/// The file location to copy output files to
///
- public string OutputPath { get; set; } = null;
+ public string OutputPath { get; set; }
///
/// The product builders to use for generating the bootstrapper
diff --git a/src/Tasks/CallTarget.cs b/src/Tasks/CallTarget.cs
index 3ce6ae1b3b0..be5ad2c2fe2 100644
--- a/src/Tasks/CallTarget.cs
+++ b/src/Tasks/CallTarget.cs
@@ -49,7 +49,7 @@ public class CallTarget : TaskExtension
///
/// Deprecated. Does nothing.
///
- public bool UseResultsCache { get; set; } = false;
+ public bool UseResultsCache { get; set; }
#endregion
diff --git a/src/Tasks/CodeTaskFactory.cs b/src/Tasks/CodeTaskFactory.cs
index 77c8c929879..1f2cbf657ac 100644
--- a/src/Tasks/CodeTaskFactory.cs
+++ b/src/Tasks/CodeTaskFactory.cs
@@ -1045,7 +1045,7 @@ public sealed class CodeTaskFactory : ITaskFactory
{
public string FactoryName => "Code Task Factory";
- public Type TaskType { get; } = null;
+ public Type TaskType { get; }
public bool Initialize(string taskName, IDictionary parameterGroup, string taskBody, IBuildEngine taskFactoryLoggingHost)
{
diff --git a/src/Tasks/CombineTargetFrameworkInfoProperties.cs b/src/Tasks/CombineTargetFrameworkInfoProperties.cs
index 4108feb5246..45ab4f3befb 100644
--- a/src/Tasks/CombineTargetFrameworkInfoProperties.cs
+++ b/src/Tasks/CombineTargetFrameworkInfoProperties.cs
@@ -27,7 +27,7 @@ public class CombineTargetFrameworkInfoProperties : TaskExtension
///
/// Opts into or out of using the new schema with Property Name=... rather than just specifying the RootElementName.
///
- public bool UseAttributeForTargetFrameworkInfoPropertyNames { get; set; } = false;
+ public bool UseAttributeForTargetFrameworkInfoPropertyNames { get; set; }
///
/// The generated XML representation of the properties and values.
diff --git a/src/Tasks/CreateItem.cs b/src/Tasks/CreateItem.cs
index f386549f525..6257dd3c57f 100644
--- a/src/Tasks/CreateItem.cs
+++ b/src/Tasks/CreateItem.cs
@@ -26,7 +26,7 @@ public class CreateItem : TaskExtension
///
/// Only apply the additional metadata is none already exists
///
- public bool PreserveExistingMetadata { get; set; } = false;
+ public bool PreserveExistingMetadata { get; set; }
///
/// A list of metadata name/value pairs to apply to the output items.
diff --git a/src/Tasks/CreateManifestResourceName.cs b/src/Tasks/CreateManifestResourceName.cs
index 49d1b38bd52..495bdb26aad 100644
--- a/src/Tasks/CreateManifestResourceName.cs
+++ b/src/Tasks/CreateManifestResourceName.cs
@@ -59,7 +59,7 @@ public ITaskItem[] ResourceFiles
///
/// Rootnamespace to use for naming.
///
- public string RootNamespace { get; set; } = null;
+ public string RootNamespace { get; set; }
///
/// The resulting manifest names.
diff --git a/src/Tasks/Delete.cs b/src/Tasks/Delete.cs
index 92dd730eca9..f9d49572d1e 100644
--- a/src/Tasks/Delete.cs
+++ b/src/Tasks/Delete.cs
@@ -38,7 +38,7 @@ public ITaskItem[] Files
///
/// When true, errors will be logged as warnings.
///
- public bool TreatErrorsAsWarnings { get; set; } = false;
+ public bool TreatErrorsAsWarnings { get; set; }
[Output]
public ITaskItem[] DeletedFiles { get; set; }
diff --git a/src/Tasks/DependencyFile.cs b/src/Tasks/DependencyFile.cs
index c3d4ab2f05a..84e6fcc3789 100644
--- a/src/Tasks/DependencyFile.cs
+++ b/src/Tasks/DependencyFile.cs
@@ -26,7 +26,7 @@ internal class DependencyFile
internal DateTime lastModified;
// Whether the file exists or not.
- internal bool exists = false;
+ internal bool exists;
///
/// The name of the file.
diff --git a/src/Tasks/GenerateDeploymentManifest.cs b/src/Tasks/GenerateDeploymentManifest.cs
index d4ff40421a4..38bc1a91a2b 100644
--- a/src/Tasks/GenerateDeploymentManifest.cs
+++ b/src/Tasks/GenerateDeploymentManifest.cs
@@ -72,7 +72,7 @@ public bool Install
set => _install = value;
}
- public string MinimumRequiredVersion { get; set; } = null;
+ public string MinimumRequiredVersion { get; set; }
public bool MapFileExtensions
{
@@ -97,7 +97,7 @@ public string SuiteName
set => _suiteName = value;
}
- public string SupportUrl { get; set; } = null;
+ public string SupportUrl { get; set; }
public bool TrustUrlParameters
{
diff --git a/src/Tasks/GenerateManifestBase.cs b/src/Tasks/GenerateManifestBase.cs
index 026cdfb8da1..2d276b2e0da 100644
--- a/src/Tasks/GenerateManifestBase.cs
+++ b/src/Tasks/GenerateManifestBase.cs
@@ -51,9 +51,9 @@ protected GenerateManifestBase() : base(AssemblyResources.PrimaryResources, "MSB
[Output]
public ITaskItem OutputManifest { get; set; }
- public string Platform { get; set; } = null;
+ public string Platform { get; set; }
- public string TargetCulture { get; set; } = null;
+ public string TargetCulture { get; set; }
public string TargetFrameworkVersion
{
diff --git a/src/Tasks/GenerateResource.cs b/src/Tasks/GenerateResource.cs
index 4dabaed7f16..163432c8cdc 100644
--- a/src/Tasks/GenerateResource.cs
+++ b/src/Tasks/GenerateResource.cs
@@ -58,23 +58,23 @@ public sealed partial class GenerateResource : TaskExtension
private ResGenDependencies _cache;
// This is where we store the list of input files/sources
- private ITaskItem[] _sources = null;
+ private ITaskItem[] _sources;
// Indicates whether the resource reader should use the source file's
// directory to resolve relative file paths.
- private bool _useSourcePath = false;
+ private bool _useSourcePath;
// This is needed for the actual items from the project
- private ITaskItem[] _references = null;
+ private ITaskItem[] _references;
// Any additional inputs to dependency checking.
- private ITaskItem[] _additionalInputs = null;
+ private ITaskItem[] _additionalInputs;
// This is the path/name of the dependency cache file
- private ITaskItem _stateFile = null;
+ private ITaskItem _stateFile;
// This list is all of the resource file(s) generated by the task
- private ITaskItem[] _outputResources = null;
+ private ITaskItem[] _outputResources;
// List of those output resources that were not actually created, due to an error
private ArrayList _unsuccessfullyCreatedOutFiles = new ArrayList();
@@ -83,28 +83,28 @@ public sealed partial class GenerateResource : TaskExtension
private ArrayList _filesWritten = new ArrayList();
// StronglyTypedLanguage
- private string _stronglyTypedLanguage = null;
+ private string _stronglyTypedLanguage;
// StronglyTypedNamespace
- private string _stronglyTypedNamespace = null;
+ private string _stronglyTypedNamespace;
// StronglyTypedManifestPrefix
- private string _stronglyTypedManifestPrefix = null;
+ private string _stronglyTypedManifestPrefix;
// StronglyTypedClassName
- private string _stronglyTypedClassName = null;
+ private string _stronglyTypedClassName;
// StronglyTypedFileName
- private string _stronglyTypedFileName = null;
+ private string _stronglyTypedFileName;
// Whether the STR class should have public members; default is false
- private bool _publicClass = false;
+ private bool _publicClass;
// Did the CodeDOM succeed when creating any Strongly Typed Resource class?
- private bool _stronglyTypedResourceSuccessfullyCreated = false;
+ private bool _stronglyTypedResourceSuccessfullyCreated;
// When true, a separate AppDomain is always created.
- private bool _neverLockTypeAssemblies = false;
+ private bool _neverLockTypeAssemblies;
// Newest uncorrelated input,
// or null if not yet determined
@@ -200,7 +200,7 @@ public ITaskItem[] References
/// format. .NET Core-targeted assemblies should use this; it's the only way to support
/// non-string resources with MSBuild running on .NET Core.
///
- public bool UsePreserializedResources { get; set; } = false;
+ public bool UsePreserializedResources { get; set; }
///
/// Additional inputs to the dependency checking done by this task. For example,
@@ -937,7 +937,7 @@ public override bool Execute()
private const uint ZoneUntrusted = 4;
- private static IInternetSecurityManager internetSecurityManager = null;
+ private static IInternetSecurityManager internetSecurityManager;
// Resources can have arbitrarily serialized objects in them which can execute arbitrary code
// so check to see if we should trust them before analyzing them
@@ -2236,7 +2236,7 @@ internal sealed class ProcessResourceFiles
///
/// Logger for any messages or errors
///
- private TaskLoggingHelper _logger = null;
+ private TaskLoggingHelper _logger;
///
/// Language for the strongly typed resources.
@@ -2289,7 +2289,7 @@ internal string StronglyTypedClassName
/// Class that gets called by the ResxResourceReader to resolve references
/// to assemblies within the .RESX.
///
- private AssemblyNamesTypeResolutionService _typeResolver = null;
+ private AssemblyNamesTypeResolutionService _typeResolver;
///
/// Handles assembly resolution events.
@@ -2384,15 +2384,15 @@ internal bool StronglyTypedResourceSuccessfullyCreated
return _stronglyTypedResourceSuccessfullyCreated;
}
}
- private bool _stronglyTypedResourceSuccessfullyCreated = false;
+ private bool _stronglyTypedResourceSuccessfullyCreated;
///
/// Indicates whether the resource reader should use the source file's
/// directory to resolve relative file paths.
///
- private bool _useSourcePath = false;
+ private bool _useSourcePath;
-#endregion
+ #endregion
///
/// Process all files.
diff --git a/src/Tasks/ManifestUtil/AssemblyReference.cs b/src/Tasks/ManifestUtil/AssemblyReference.cs
index 702790b55d4..dcf11495771 100644
--- a/src/Tasks/ManifestUtil/AssemblyReference.cs
+++ b/src/Tasks/ManifestUtil/AssemblyReference.cs
@@ -40,10 +40,10 @@ public enum AssemblyReferenceType
[ComVisible(false)]
public sealed class AssemblyReference : BaseReference
{
- private AssemblyIdentity _assemblyIdentity = null;
- private bool _isPrerequisite = false;
+ private AssemblyIdentity _assemblyIdentity;
+ private bool _isPrerequisite;
private AssemblyReferenceType _referenceType = AssemblyReferenceType.Unspecified;
- private bool _isPrimary = false;
+ private bool _isPrimary;
///
/// Initializes a new instance of the AssemblyReference class.
diff --git a/src/Tasks/ManifestUtil/mansign2.cs b/src/Tasks/ManifestUtil/mansign2.cs
index 2923d63cddb..c008f9b49c6 100644
--- a/src/Tasks/ManifestUtil/mansign2.cs
+++ b/src/Tasks/ManifestUtil/mansign2.cs
@@ -240,7 +240,7 @@ [In] [MarshalAs(UnmanagedType.LPStr)] string pszHashId,
internal class ManifestSignedXml2 : SignedXml
{
- private bool _verify = false;
+ private bool _verify;
private const string Sha256SignatureMethodUri = @"http://www.w3.org/2000/09/xmldsig#rsa-sha256";
private const string Sha256DigestMethod = @"http://www.w3.org/2000/09/xmldsig#sha256";
@@ -310,9 +310,9 @@ public override XmlElement GetIdElement(XmlDocument document, string idValue)
internal class SignedCmiManifest2
{
- private XmlDocument _manifestDom = null;
- private CmiStrongNameSignerInfo _strongNameSignerInfo = null;
- private CmiAuthenticodeSignerInfo _authenticodeSignerInfo = null;
+ private XmlDocument _manifestDom;
+ private CmiStrongNameSignerInfo _strongNameSignerInfo;
+ private CmiAuthenticodeSignerInfo _authenticodeSignerInfo;
private bool _useSha256;
private const string Sha256SignatureMethodUri = @"http://www.w3.org/2000/09/xmldsig#rsa-sha256";
@@ -1163,9 +1163,9 @@ internal CmiManifestSignerFlag Flag
internal class CmiStrongNameSignerInfo
{
- private int _error = 0;
- private string _publicKeyToken = null;
- private AsymmetricAlgorithm _snKey = null;
+ private int _error;
+ private string _publicKeyToken;
+ private AsymmetricAlgorithm _snKey;
internal CmiStrongNameSignerInfo() { }
@@ -1217,13 +1217,13 @@ internal AsymmetricAlgorithm PublicKey
internal class CmiAuthenticodeSignerInfo
{
- private int _error = 0;
- private X509Chain _signerChain = null;
- private uint _algHash = 0;
- private string _hash = null;
- private string _description = null;
- private string _descriptionUrl = null;
- private CmiAuthenticodeTimestamperInfo _timestamperInfo = null;
+ private int _error;
+ private X509Chain _signerChain;
+ private uint _algHash;
+ private string _hash;
+ private string _description;
+ private string _descriptionUrl;
+ private CmiAuthenticodeTimestamperInfo _timestamperInfo;
internal CmiAuthenticodeSignerInfo() { }
@@ -1343,10 +1343,10 @@ internal X509Chain SignerChain
internal class CmiAuthenticodeTimestamperInfo
{
- private int _error = 0;
- private X509Chain _timestamperChain = null;
+ private int _error;
+ private X509Chain _timestamperChain;
private DateTime _timestampTime;
- private uint _algHash = 0;
+ private uint _algHash;
private CmiAuthenticodeTimestamperInfo() { }
diff --git a/src/Tasks/ResolveKeySource.cs b/src/Tasks/ResolveKeySource.cs
index 676d5a4d249..96509cdf875 100644
--- a/src/Tasks/ResolveKeySource.cs
+++ b/src/Tasks/ResolveKeySource.cs
@@ -34,9 +34,9 @@ public class ResolveKeySource : TaskExtension
public string CertificateFile { get; set; }
- public bool SuppressAutoClosePasswordPrompt { get; set; } = false;
+ public bool SuppressAutoClosePasswordPrompt { get; set; }
- public bool ShowImportDialogDespitePreviousFailures { get; set; } = false;
+ public bool ShowImportDialogDespitePreviousFailures { get; set; }
public int AutoClosePasswordPromptTimeout { get; set; } = 20;
diff --git a/src/Tasks/ResolveManifestFiles.cs b/src/Tasks/ResolveManifestFiles.cs
index 62bd9251366..8cb3770eda6 100644
--- a/src/Tasks/ResolveManifestFiles.cs
+++ b/src/Tasks/ResolveManifestFiles.cs
@@ -92,10 +92,10 @@ public ITaskItem[] NativeAssemblies
public ITaskItem[] RuntimePackAssets { get; set; }
// True if deployment mode during publish is set to self-contained mode
- public bool IsSelfContainedPublish { get; set; } = false;
+ public bool IsSelfContainedPublish { get; set; }
// True if single file publish is on
- public bool IsSingleFilePublish { get; set; } = false;
+ public bool IsSingleFilePublish { get; set; }
[Output]
public ITaskItem[] OutputAssemblies { get; set; }
@@ -127,7 +127,7 @@ public ITaskItem[] SatelliteAssemblies
public string AssemblyName { get; set; }
- public bool LauncherBasedDeployment {get; set; } = false;
+ public bool LauncherBasedDeployment {get; set; }
public string TargetFrameworkVersion
{
diff --git a/src/Tasks/System.Design.cs b/src/Tasks/System.Design.cs
index 0ab4947d7b6..f0e8ba1e3d1 100644
--- a/src/Tasks/System.Design.cs
+++ b/src/Tasks/System.Design.cs
@@ -16,7 +16,7 @@ namespace Microsoft.Build.Tasks
[AttributeUsage(AttributeTargets.All)]
internal sealed class SRDescriptionAttribute : DescriptionAttribute
{
- private bool _replaced = false;
+ private bool _replaced;
///
/// Constructs a new sys description.
@@ -81,7 +81,7 @@ internal sealed class SR
internal const string MismatchedResourceName = "MismatchedResourceName";
internal const string InvalidIdentifier = "InvalidIdentifier";
- private static SR s_loader = null;
+ private static SR s_loader;
private MainAssemblyFallbackResourceManager _resources;
///
diff --git a/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs b/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs
index a9195d3f89d..24a43538d99 100644
--- a/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs
+++ b/src/Tasks/XamlTaskFactory/XamlTaskFactory.cs
@@ -246,7 +246,7 @@ public sealed class XamlTaskFactory : ITaskFactory
{
public string FactoryName => "XamlTaskFactory";
- public Type TaskType { get; } = null;
+ public Type TaskType { get; }
public bool Initialize(string taskName, IDictionary parameterGroup, string taskBody, IBuildEngine taskFactoryLoggingHost)
{
diff --git a/src/Utilities/ToolLocationHelper.cs b/src/Utilities/ToolLocationHelper.cs
index 28d03e97be8..7e831e8f0d5 100644
--- a/src/Utilities/ToolLocationHelper.cs
+++ b/src/Utilities/ToolLocationHelper.cs
@@ -257,7 +257,7 @@ public static class ToolLocationHelper
///
/// Cache the list of supported frameworks
///
- private static List s_targetFrameworkMonikers = null;
+ private static List s_targetFrameworkMonikers;
///
/// Cache the VS Install folders for particular range of VS versions
diff --git a/src/Utilities/ToolTask.cs b/src/Utilities/ToolTask.cs
index 6eb42bff3ff..2af0fe9fda5 100644
--- a/src/Utilities/ToolTask.cs
+++ b/src/Utilities/ToolTask.cs
@@ -263,18 +263,18 @@ public virtual string ToolExe
/// Task Parameter: Importance with which to log text from the
/// standard out stream.
///
- public string StandardOutputImportance { get; set; } = null;
+ public string StandardOutputImportance { get; set; }
///
/// Task Parameter: Importance with which to log text from the
/// standard error stream.
///
- public string StandardErrorImportance { get; set; } = null;
+ public string StandardErrorImportance { get; set; }
///
/// Should ALL messages received on the standard error stream be logged as errors.
///
- public bool LogStandardErrorAsError { get; set; } = false;
+ public bool LogStandardErrorAsError { get; set; }
///
/// Importance with which to log text from in the