Skip to content

Migrate SGen task to Task environment API#13457

Merged
OvesN merged 35 commits into
dotnet:mainfrom
OvesN:dev/veronikao/migrate-SGen-Task-to-TaskEnvironment-API
Apr 15, 2026
Merged

Migrate SGen task to Task environment API#13457
OvesN merged 35 commits into
dotnet:mainfrom
OvesN:dev/veronikao/migrate-SGen-Task-to-TaskEnvironment-API

Conversation

@OvesN

@OvesN OvesN commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #13455

Context

The SGen task was made thread-safe.

Changes Made

SGen.cs

  • Routed file existence checks and path resolution through TaskEnvironment.GetAbsolutePath().

Testing

Unit tests in SGen_Tests.cs

Notes

OvesN and others added 16 commits March 20, 2026 13:56
The test relied on FileAttributes.ReadOnly to force File.Delete to throw,
but this is not cross-platform - Unix read-only attributes don't prevent deletion.
ApplyEnvironmentOverrides  moved inside SetUpProcessStartInfo.
Added override for DeleteTempFile using AbsolutePath.
Made Driver private again, expose only enum value to decided if driver is multitheaded.
Made GetProcessStartInfoMultithreadable private.
add overload for DeleteTempFile with AbsolutePath argument
…nto dev/veronikao/migrate-SGen-Task-to-TaskEnvironment-API
@OvesN OvesN self-assigned this Mar 30, 2026
@OvesN OvesN marked this pull request as draft March 30, 2026 13:09
@OvesN OvesN changed the base branch from dev/veronikao/migrate-Al-task-to-TaskEnvironment-API to main April 8, 2026 06:38
@OvesN OvesN marked this pull request as ready for review April 8, 2026 06:54
Copilot AI review requested due to automatic review settings April 8, 2026 06:54

Copilot AI 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

Migrates the SGen task to the TaskEnvironment API to support thread-safe/multithreaded execution by routing path resolution, file existence checks, and environment variable access through the task environment.

Changes:

  • Marked SGen as multithreadable and updated it to use TaskEnvironment.GetAbsolutePath() / GetEnvironmentVariable().
  • Switched several internal path computations to use AbsolutePath.
  • Added unit tests covering TaskEnvironment integration for tool path resolution, working directory propagation, and BuildAssemblyPath absolutization.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/Tasks/SGen.cs Uses TaskEnvironment for env/path operations and introduces AbsolutePath usage for key paths.
src/Tasks.UnitTests/SGen_Tests.cs Adds tests validating the multithreaded TaskEnvironment behavior for SGen.

Comment thread src/Tasks/SGen.cs Outdated
Comment thread src/Tasks/SGen.cs Outdated
Comment thread src/Tasks/SGen.cs Outdated
Comment thread src/Tasks.UnitTests/SGen_Tests.cs Outdated
Comment thread src/Tasks.UnitTests/SGen_Tests.cs Outdated
Comment thread src/Tasks/SGen.cs
@OvesN OvesN marked this pull request as draft April 8, 2026 07:55
This was referenced Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate SGen Task to TaskEnvironment API

4 participants