diff --git a/src/Build/BackEnd/BuildManager/BuildManager.cs b/src/Build/BackEnd/BuildManager/BuildManager.cs index fc71b1c1d1d..bc1e535abab 100644 --- a/src/Build/BackEnd/BuildManager/BuildManager.cs +++ b/src/Build/BackEnd/BuildManager/BuildManager.cs @@ -118,7 +118,7 @@ public class BuildManager : INodePacketHandler, IBuildComponentHost, IDisposable /// /// Set of active nodes in the system. /// - private readonly HashSet> _activeNodes; + private readonly HashSet _activeNodes; /// /// Event signalled when all nodes have shutdown. @@ -128,7 +128,7 @@ public class BuildManager : INodePacketHandler, IBuildComponentHost, IDisposable /// /// Mapping of nodes to the configurations they know about. /// - private readonly Dictionary, HashSet>> _nodeIdToKnownConfigurations; + private readonly Dictionary> _nodeIdToKnownConfigurations; /// /// Flag indicating if we are currently shutting down. When set, we stop processing packets other than NodeShutdown. @@ -301,9 +301,9 @@ public BuildManager(string hostName) _buildSubmissions = new Dictionary(); _graphBuildSubmissions = new Dictionary(); _noActiveSubmissionsEvent = new AutoResetEvent(true); - _activeNodes = new HashSet>(); + _activeNodes = new HashSet(); _noNodesActiveEvent = new AutoResetEvent(true); - _nodeIdToKnownConfigurations = new Dictionary, HashSet>>(); + _nodeIdToKnownConfigurations = new Dictionary>(); _unnamedProjectInstanceToNames = new Dictionary(); _nextUnnamedProjectId = 1; _componentFactories = new BuildComponentFactoryCollection(this); @@ -2394,9 +2394,9 @@ private void HandleConfigurationRequest(int node, BuildRequestConfiguration unre var response = new BuildRequestConfigurationResponse(unresolvedConfiguration.ConfigurationId, resolvedConfiguration.ConfigurationId, resolvedConfiguration.ResultsNodeId); - if (!_nodeIdToKnownConfigurations.TryGetValue(node, out HashSet> configurationsOnNode)) + if (!_nodeIdToKnownConfigurations.TryGetValue(node, out HashSet configurationsOnNode)) { - configurationsOnNode = new HashSet>(); + configurationsOnNode = new HashSet(); _nodeIdToKnownConfigurations[node] = configurationsOnNode; } @@ -2664,7 +2664,7 @@ private void PerformSchedulingActions(IEnumerable responses) // of which nodes have had configurations specifically assigned to them for building. However, a node may // have created a configuration based on a build request it needs to wait on. In this // case we need not send the configuration since it will already have been mapped earlier. - if (!_nodeIdToKnownConfigurations.TryGetValue(response.NodeId, out HashSet> configurationsOnNode) || + if (!_nodeIdToKnownConfigurations.TryGetValue(response.NodeId, out HashSet configurationsOnNode) || !configurationsOnNode.Contains(response.BuildRequest.ConfigurationId)) { IConfigCache configCache = _componentFactories.GetComponent(BuildComponentType.ConfigCache) as IConfigCache; diff --git a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs index ef42f9fe895..297ac265e0e 100644 --- a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs +++ b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs @@ -1122,7 +1122,7 @@ private void IssueBuildRequests(BuildRequestEntry issuingEntry, FullyQualifiedBu lock (issuingEntry.GlobalLock) { var existingResultsToReport = new List(); - var unresolvedConfigurationsAdded = new HashSet>(); + var unresolvedConfigurationsAdded = new HashSet(); foreach (FullyQualifiedBuildRequest request in newRequests) { diff --git a/src/Build/Evaluation/Evaluator.cs b/src/Build/Evaluation/Evaluator.cs index 1674765bb2d..3609af082d5 100644 --- a/src/Build/Evaluation/Evaluator.cs +++ b/src/Build/Evaluation/Evaluator.cs @@ -115,7 +115,7 @@ internal class Evaluator /// Dictionary of project full paths and a boolean that indicates whether at least one /// of their targets has the "Returns" attribute set. /// - private readonly Dictionary> _projectSupportsReturnsAttribute; + private readonly Dictionary _projectSupportsReturnsAttribute; /// /// The Project Xml to be evaluated. @@ -253,7 +253,7 @@ private Evaluator( _targetElements = new List(); _importsSeen = new Dictionary(StringComparer.OrdinalIgnoreCase); _initialTargetsList = new List(); - _projectSupportsReturnsAttribute = new Dictionary>(); + _projectSupportsReturnsAttribute = new Dictionary(); _projectRootElement = projectRootElement; _loadSettings = loadSettings; _maxNodeCount = maxNodeCount; @@ -901,7 +901,7 @@ private void PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) break; case ProjectTargetElement target: // Defaults to false - _projectSupportsReturnsAttribute.TryGetValue(currentProjectOrImport, out NGen projectSupportsReturnsAttribute); + _projectSupportsReturnsAttribute.TryGetValue(currentProjectOrImport, out bool projectSupportsReturnsAttribute); _projectSupportsReturnsAttribute[currentProjectOrImport] = projectSupportsReturnsAttribute || (target.Returns != null); _targetElements.Add(target); diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj index 57a10354c83..8b6a56d5713 100644 --- a/src/Build/Microsoft.Build.csproj +++ b/src/Build/Microsoft.Build.csproj @@ -82,9 +82,6 @@ IConstrainedEqualityComparer.cs - - SharedUtilities\NGen.cs - BackEnd\Components\RequestBuilder\IntrinsicTasks\PropertyParser.cs diff --git a/src/Shared/NGen.cs b/src/Shared/NGen.cs deleted file mode 100644 index f37252e7049..00000000000 --- a/src/Shared/NGen.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.Build.Shared -{ - /// - /// To avoid CA908 warnings (types that in ngen images that will JIT) - /// wrap each problematic value type in the collection in - /// one of these objects. - /// - /// - /// This trick is based on advice from - /// http://sharepoint/sites/codeanalysis/Wiki%20Pages/Rule%20-%20Avoid%20Types%20That%20Require%20JIT%20Compilation%20In%20Precompiled%20Assemblies.aspx. - /// It works because although this is a value type, it is not defined in mscorlib. - /// - /// Wrapped type - internal struct NGen where T : struct - { - /// - /// Wrapped value - /// - private T _value; - - /// - /// Constructor - /// - public NGen(T value) - { - _value = value; - } - - /// - /// Exposes the value - /// - public static implicit operator T(NGen value) - { - return value._value; - } - - /// - /// Consumes the value - /// - public static implicit operator NGen(T value) - { - return new NGen(value); - } - } -} diff --git a/src/Tasks/ManifestUtil/ApplicationManifest.cs b/src/Tasks/ManifestUtil/ApplicationManifest.cs index 228d7f70fe4..8f16267ee8d 100644 --- a/src/Tasks/ManifestUtil/ApplicationManifest.cs +++ b/src/Tasks/ManifestUtil/ApplicationManifest.cs @@ -640,7 +640,7 @@ private void ValidateReferencesForClickOnceApplication() { int t1 = Environment.TickCount; bool isPartialTrust = !TrustInfo.IsFullTrust; - var targetPathList = new Dictionary>(); + var targetPathList = new Dictionary(); foreach (AssemblyReference assembly in AssemblyReferences) { diff --git a/src/Tasks/ManifestUtil/Manifest.cs b/src/Tasks/ManifestUtil/Manifest.cs index 629fcb877e0..28d4f6131df 100644 --- a/src/Tasks/ManifestUtil/Manifest.cs +++ b/src/Tasks/ManifestUtil/Manifest.cs @@ -611,7 +611,7 @@ private void ValidateReferences() return; } - var identityList = new Dictionary>(); + var identityList = new Dictionary(); foreach (AssemblyReference assembly in AssemblyReferences) { if (assembly.AssemblyIdentity != null) diff --git a/src/Tasks/Microsoft.Build.Tasks.csproj b/src/Tasks/Microsoft.Build.Tasks.csproj index d7423cf5c26..bc452fcfe7d 100644 --- a/src/Tasks/Microsoft.Build.Tasks.csproj +++ b/src/Tasks/Microsoft.Build.Tasks.csproj @@ -73,9 +73,6 @@ FileDelegates.cs - - NGen.cs - PropertyParser.cs diff --git a/src/Tasks/RedistList.cs b/src/Tasks/RedistList.cs index f439aa4939b..dd5c9123649 100644 --- a/src/Tasks/RedistList.cs +++ b/src/Tasks/RedistList.cs @@ -48,7 +48,7 @@ internal sealed class RedistList /// When we check to see if an assembly is in this redist list we want to cache it so that if we ask again we do not /// have to re-scan bits of the redist list and do the assemblynameExtension comparisons. /// - private readonly ConcurrentDictionary> _assemblyNameInRedist = new ConcurrentDictionary>(AssemblyNameComparer.GenericComparer); + private readonly ConcurrentDictionary _assemblyNameInRedist = new ConcurrentDictionary(AssemblyNameComparer.GenericComparer); /// /// AssemblyName to unified assemblyName. We make this kind of call a lot and also will ask for the same name multiple times. @@ -431,7 +431,7 @@ public bool FrameworkAssemblyEntryInRedist(AssemblyNameExtension assemblyName) { ErrorUtilities.VerifyThrowArgumentNull(assemblyName, nameof(assemblyName)); - if (!_assemblyNameInRedist.TryGetValue(assemblyName, out NGen isAssemblyNameInRedist)) + if (!_assemblyNameInRedist.TryGetValue(assemblyName, out bool isAssemblyNameInRedist)) { string simpleName = GetSimpleName(assemblyName.Name); if (_simpleNameMap.TryGetValue(simpleName, out int index))