Skip to content

Add SourceLink opt-out for sandbox builds - #820

Merged
AndreaCuneo merged 2 commits into
masterfrom
copilot/disable-sourcelink-in-build
Aug 2, 2026
Merged

Add SourceLink opt-out for sandbox builds#820
AndreaCuneo merged 2 commits into
masterfrom
copilot/disable-sourcelink-in-build

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Builds in Copilot sandboxes can fail when SourceLink cannot access repository metadata. This adds an opt-in environment switch for those environments while preserving default SourceLink behavior.

  • Build configuration
    • Added ARK_DISABLE_SOURCELINK=true handling to repository and sample Directory.Build.props files.
    • Disables EnableSourceLink and EnableSourceControlManagerQueries when enabled.
ARK_DISABLE_SOURCELINK=true dotnet build

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
@AndreaCuneo

Copy link
Copy Markdown
Contributor

the msbuild should detect being in a sandbox. look for some env Variable that identify this env as a Sandbox.

the PR as is it is useless as was already possible to pass EnableSourceLink=false in a -p: parameter on dotnet build. The task is to find a detection point.

@copilot

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

the msbuild should detect being in a sandbox. look for some env Variable that identify this env as a Sandbox.

the PR as is it is useless as was already possible to pass EnableSourceLink=false in a -p...

Implemented automatic detection using the Copilot sandbox's COPILOT_AGENT_ACTION environment variable. SourceLink is now disabled automatically in Copilot agent builds and remains unchanged elsewhere. Commit: 23b40fa.

Copilot AI requested a review from AndreaCuneo August 2, 2026 09:35
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review August 2, 2026 09:35
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner August 2, 2026 09:35
Copilot AI review requested due to automatic review settings August 2, 2026 09:35

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

Adds a build-time switch intended to disable SourceLink in Copilot sandbox environments where repository metadata is unavailable, to avoid build failures while keeping SourceLink enabled by default.

Changes:

  • Introduces a SourceLink property group in repo and sample Directory.Build.props files.
  • Disables EnableSourceLink and EnableSourceControlManagerQueries under a sandbox-detection condition.

Reviewed changes

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

File Description
Directory.Build.props Adds conditional disabling of SourceLink/SCM queries for sandbox-like environments.
samples/Ark.ResourceWatcher/Directory.Build.props Mirrors the conditional SourceLink/SCM query disabling in this sample.
samples/Ark.ReferenceProject/Directory.Build.props Mirrors the conditional SourceLink/SCM query disabling in this sample.
samples/Ark.MediatorFramework.Sample/Directory.Build.props Mirrors the conditional SourceLink/SCM query disabling in this sample.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/Ark.ResourceWatcher/Directory.Build.props
Comment thread Directory.Build.props
Comment thread samples/Ark.ReferenceProject/Directory.Build.props
Comment thread samples/Ark.MediatorFramework.Sample/Directory.Build.props
@AndreaCuneo
AndreaCuneo merged commit 83b8034 into master Aug 2, 2026
7 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/disable-sourcelink-in-build branch August 2, 2026 09:48
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.

3 participants