Browse Source

Disable parallel restore for linker tests (#65372)

* Disable parallel restore for linker tests

* Disable parallel restore for trimming tests

* Update comment to reference new GitHub issue

* Add property to disable parallel restore for trimming tests

Added a property group to disable parallel restore for trimming test projects to mitigate a specific issue.

* Update PublishTrimmedProjects target for parallel build

* Fix PropertyGroup closing tag in Directory.Build.props
William Godbe 4 weeks ago
parent
commit
a218afe4bd

+ 5 - 0
Directory.Build.props

@@ -87,6 +87,11 @@
      <DisableLogTaskParameterItemMetadata_Csc_References>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Csc_References>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(IsTrimmingTestProject)' == 'true'">
+    <!-- Should mitigate https://github.com/dotnet/aspnetcore/issues/61178 -->
+    <RestoreDisableParallel>true</RestoreDisableParallel>
+  </PropertyGroup>
+
   <Import Project="eng\QuarantinedTests.BeforeArcade.props" />
   <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
   <Import Project="eng\QuarantinedTests.AfterArcade.props" />

+ 2 - 0
eng/testing/linker/project.csproj.template

@@ -15,6 +15,8 @@
     <InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.AspNetCore.Http.Generated;Microsoft.Extensions.Validation.Generated</InterceptorsPreviewNamespaces>
     <!-- Ensure individual warnings are shown when publishing -->
     <TrimmerSingleWarn>false</TrimmerSingleWarn>
+    <!-- Should mitigate https://github.com/dotnet/aspnetcore/issues/61178 -->
+    <RestoreDisableParallel>true</RestoreDisableParallel>
     {AdditionalProperties}
   </PropertyGroup>
 

+ 2 - 1
eng/testing/linker/trimmingTests.targets

@@ -102,9 +102,10 @@
           DependsOnTargets="GenerateProjects">
 
     <MSBuild Projects="@(TestConsoleApps)"
+             BuildInParallel="false"
              Targets="Restore"
              Condition="'$(SkipTrimmingProjectsRestore)' != 'true'"
-             Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());Configuration=$(Configuration)" />
+             Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());Configuration=$(Configuration);RestoreDisableParallel=true" />
 
     <MSBuild Projects="@(TestConsoleApps)"
              Targets="Publish"