Skip to content

Remove <Optimize>True</Optimize> from src/tests/async project files - #121945

Merged
MichalStrehovsky merged 2 commits into
mainfrom
copilot/remove-optimize-tag-and-empty-property-groups
Nov 26, 2025
Merged

Remove <Optimize>True</Optimize> from src/tests/async project files#121945
MichalStrehovsky merged 2 commits into
mainfrom
copilot/remove-optimize-tag-and-empty-property-groups

Conversation

CopilotAI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Removes <Optimize>True</Optimize> from all .csproj files under src/tests/async, along with any <PropertyGroup> elements left empty after removal.

Changes

  • 31 files: Removed entire <PropertyGroup> block (contained only <Optimize>True</Optimize>)
  • 11 files: Removed <Optimize>True</Optimize> line only, preserving other properties (CLRTestKind, RequiresProcessIsolation, DefineConstants, etc.)

Before:

<ProjectSdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<CompileInclude="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>

After:

<ProjectSdk="Microsoft.NET.Sdk.IL">
<ItemGroup>
<CompileInclude="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
Original prompt

remove <Optimize>True</Optimize> from all project files under src/tests/async. Also remove any empty <PropertyGroup> that are left in the project file after removing the Optimize tag


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
CopilotAI changed the title [WIP] Remove <Optimize>True</Optimize> from project files and clean upRemove <Optimize>True</Optimize> from src/tests/async project filesNov 25, 2025
@MichalStrehovsky
MichalStrehovsky marked this pull request as ready for review November 25, 2025 06:41
CopilotAI review requested due to automatic review settings November 25, 2025 06:41
@MichalStrehovsky

Copy link
Copy Markdown
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes redundant <Optimize>True</Optimize> settings from 42 async test project files, relying instead on the default optimization configuration already defined in the parent Directory.Build.props which sets optimization based on the build configuration (Debug, Release, or Checked).

  • Removes explicit optimization overrides that duplicated parent configuration
  • Cleans up empty <PropertyGroup> elements left after removal
  • Standardizes project file structure across async tests

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
without-yields/without-yields.csprojRemoved entire PropertyGroup containing only Optimize setting
with-yields/with-yields.csprojRemoved entire PropertyGroup containing only Optimize setting
widening-tailcall/widening-tailcall.csprojRemoved entire PropertyGroup containing only Optimize setting
void/void.csprojRemoved entire PropertyGroup containing only Optimize setting
varying-yields/varying-yields.csprojRemoved entire PropertyGroup containing only Optimize setting
varying-yields/varying-yields-valuetask.csprojRemoved Optimize setting, preserved DefineConstants
varying-yields/varying-yields-task.csprojRemoved Optimize setting, preserved DefineConstants
valuetaskbased-asyncfibonacci-without-yields/valuetaskbased-asyncfibonacci-without-yields.csprojRemoved Optimize setting, preserved CLRTestKind
valuetaskbased-asyncfibonacci-with-yields/valuetaskbased-asyncfibonacci-with-yields.csprojRemoved Optimize setting, preserved CLRTestKind
valuetask/valuetask.csprojRemoved entire PropertyGroup containing only Optimize setting
valuetask-source/valuetask-source.csprojRemoved Optimize setting, preserved RequiresProcessIsolation
taskbased-asyncfibonacci-without-yields/taskbased-asyncfibonacci-without-yields.csprojRemoved Optimize setting, preserved CLRTestKind
taskbased-asyncfibonacci-with-yields/taskbased-asyncfibonacci-with-yields.csprojRemoved Optimize setting, preserved CLRTestKind
synchronization-context/synchronization-context.csprojRemoved entire PropertyGroup containing only Optimize setting
syncfibonacci-without-yields/syncfibonacci-without-yields.csprojRemoved Optimize setting, preserved CLRTestKind
struct/struct.csprojRemoved entire PropertyGroup containing only Optimize setting
strength-reduction/strength-reduction.csprojRemoved entire PropertyGroup containing only Optimize setting
small/small.csprojRemoved entire PropertyGroup containing only Optimize setting
simple-eh/simple-eh.csprojRemoved entire PropertyGroup containing only Optimize setting
shared-generic/shared-generic.csprojRemoved entire PropertyGroup containing only Optimize setting
returns/returns.csprojRemoved entire PropertyGroup containing only Optimize setting
reflection/reflection-simple.csprojRemoved entire PropertyGroup containing only Optimize setting
pinvoke/pinvoke.csprojRemoved entire PropertyGroup containing only Optimize setting
pgo/pgo.csprojRemoved entire PropertyGroup containing only Optimize setting
override/override.csprojRemoved entire PropertyGroup containing only Optimize setting
objects-captured/objects-captured.csprojRemoved entire PropertyGroup containing only Optimize setting
object/object.csprojRemoved entire PropertyGroup containing only Optimize setting
mincallcost-microbench/mincallcost-microbench.csprojRemoved Optimize setting, preserved CLRTestKind
inst-unbox-thunks/inst-unbox-thunks.csprojRemoved entire PropertyGroup containing only Optimize setting
implement/implement.csprojRemoved entire PropertyGroup containing only Optimize setting
gc-roots-scan/gc-roots-scan.csprojRemoved Optimize setting, preserved CLRTestKind
fibonacci-without-yields/fibonacci-without-yields.csprojRemoved entire PropertyGroup containing only Optimize setting
fibonacci-without-yields-config-await/fibonacci-without-yields-config-await.csprojRemoved entire PropertyGroup containing only Optimize setting
fibonacci-with-yields/fibonacci-with-yields.csprojRemoved entire PropertyGroup containing only Optimize setting
fibonacci-with-yields-struct-return/fibonacci-with-yields-struct-return.csprojRemoved entire PropertyGroup containing only Optimize setting
execution-context/execution-context.csprojRemoved entire PropertyGroup containing only Optimize setting
eh-microbench/eh-microbench.csprojRemoved Optimize setting, preserved CLRTestKind
cse-array-index-byref/cse-array-index-byref.csprojRemoved entire PropertyGroup containing only Optimize setting
collectible-alc/collectible-alc.csprojRemoved Optimize setting, preserved RequiresProcessIsolation
cancellation/cancellation.csprojRemoved entire PropertyGroup containing only Optimize setting
byref-param/byref-param.csprojRemoved entire PropertyGroup containing only Optimize setting
awaitingnotasync/awaitingnotasync.csprojRemoved entire PropertyGroup containing only Optimize setting

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@jakobbotsch

jakobbotsch commented Nov 25, 2025

Copy link
Copy Markdown
Member

Does this change anything for coreclr testing? Do we now compile these unoptimized in any PR runs? (It would be unfortunate to do that – many of these tests are quite long running in debug.)

What is the NativeAOT behavior that is being tested here when the assemblies are unoptimized?

Note that we end up testing both the unoptimized and optimized JIT compilations of these tests because of tiered compilation. If the assemblies are compiled unoptimized they will only test unoptimized codegen.

@MichalStrehovsky

Copy link
Copy Markdown
Member

Does this change anything for coreclr testing? Do we now compile these unoptimized in any PR runs? (It would be unfortunate to do that – many of these tests are quite long running in debug.)

CoreCLR testing uses the IL that is the result of the "Build coreclr Common Pri0 Test Build AnyOS AnyCPU checked" leg. We only build the test tree once and the configuration is Checked (i.e. optimized, DEBUG defined). So this should have no effect on CoreCLR testing (I think we have a test gap that we never test without C# compiler optimizations lots of tests in the src/tests tree since only the JIT subtree does the _r.cspro/_ro.csproj/_d.csproj split)

What is the NativeAOT behavior that is being tested here when the assemblies are unoptimized?

Native AOT compilation picks up the value for optimization setting from the entrypoint assembly Optimization flag. When the entrypoint assembly Optimization flag is set to true, we compile with codegen optimizations and whole program optimizations. E.g. a test testing virtual method calls would have all of the virtual method calls devirtualized and possibly even inlined, not actually testing virtual call behaviors (in the spirit).

Native AOT testing builds the test tree in both debug and release to get the full coverage. We don't have Tier-0 to simulate unoptimized. If test forces itself to be optimized, we never test/execute unoptimized code for it.

@jakobbotschjakobbotsch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable given the above explanation then.

You might want to double check if the time it takes to run the tests in debug is acceptable. @davidwrighton identified the slow tests in #121862 and we should perhaps just decrease their number of iterations always.

@MichalStrehovsky

Copy link
Copy Markdown
Member

You might want to double check if the time it takes to run the tests in debug is acceptable. @davidwrighton identified the slow tests in #121862 and we should perhaps just decrease their number of iterations always.

Checked run of the async tree: Time Elapsed 00:00:33.87
Debug run of the async tree: Time Elapsed 00:00:37.54

@MichalStrehovsky

Copy link
Copy Markdown
Member

/ba-g timeouts in legs that are not related

@MichalStrehovsky
MichalStrehovsky merged commit 3266d23 into mainNov 26, 2025
102 of 105 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the copilot/remove-optimize-tag-and-empty-property-groups branch November 26, 2025 07:24
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Dec 26, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@MichalStrehovsky@jakobbotsch