Skip to content

[dotnet] Remove DOTNET_STARTUP_HOOKS 'env' workaround. Fixes #25799. - #26008

Merged
rolfbjarne merged 1 commit into
net11.0from
dev/rolf/issue-25799-remove-startup-hooks-env-workaround
Jul 10, 2026
Merged

rolfbjarne merged 1 commit into
net11.0from
dev/rolf/issue-25799-remove-startup-hooks-env-workaround

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

PR #25738 added a temporary workaround in Microsoft.Sdk.Desktop.targets for
sandboxed Mac Catalyst apps: when dotnet watch set DOTNET_STARTUP_HOOKS to a
path outside the app sandbox, we overrode RunCommand to env to force the
container-relative DOTNET_STARTUP_HOOKS value onto the launched process,
because the SDK didn't honor changes made to the @(RuntimeEnvironmentVariable)
item group after ComputeRunArguments.

dotnet/sdk#54922 now honors those
item-group changes for projects with the RuntimeEnvironmentVariableSupport
capability (which .NET for iOS / Mac Catalyst projects set), so the env
override is redundant. The targets still copy the startup hook into the sandbox
container and re-point the DOTNET_STARTUP_HOOKS @(RuntimeEnvironmentVariable)
item at it; the SDK applies that when launching.

Verified the SDK pinned in global.json (11.0.100-preview.7.26358.120)
contains the fix (HasRuntimeEnvironmentVariableSupport / ReadFromItems).

Fixes #25799

🤖 Pull request created by Copilot

PR #25738 added a temporary workaround in Microsoft.Sdk.Desktop.targets for
sandboxed Mac Catalyst apps: when 'dotnet watch' set DOTNET_STARTUP_HOOKS to a
path outside the app sandbox, we overrode RunCommand to 'env' to force the
container-relative DOTNET_STARTUP_HOOKS value onto the launched process, because
the SDK didn't honor changes made to the @(RuntimeEnvironmentVariable) item
group after ComputeRunArguments.

dotnet/sdk#54922 now honors those item-group changes for projects with the
RuntimeEnvironmentVariableSupport capability (which .NET for iOS/Mac Catalyst
projects set), so the 'env' override is redundant. The targets still copy the
startup hook into the sandbox container and re-point the DOTNET_STARTUP_HOOKS
@(RuntimeEnvironmentVariable) item at it; the SDK applies that when launching.

Verified the SDK pinned in global.json (11.0.100-preview.7.26358.120) contains
the fix (HasRuntimeEnvironmentVariableSupport / ReadFromItems).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne marked this pull request as ready for review July 9, 2026 17:42
Copilot AI review requested due to automatic review settings July 9, 2026 17:42

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

Removes a temporary MSBuild workaround in the desktop run pipeline now that the pinned .NET SDK honors post-ComputeRunArguments updates to @(RuntimeEnvironmentVariable) for projects with the RuntimeEnvironmentVariableSupport capability (used by Apple platforms in this repo).

Changes:

  • Removed the RunCommand=env / RunArguments="DOTNET_STARTUP_HOOKS=..." override previously used for RunWithOpen=false.
  • Kept the existing logic that copies the startup hook into the Mac Catalyst sandbox container and repoints DOTNET_STARTUP_HOOKS via @(RuntimeEnvironmentVariable).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #42ad6c3] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 42ad6c3bac550f981054199dcc6234dcdc373e91 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 42ad6c3bac550f981054199dcc6234dcdc373e91 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #42ad6c3] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 42ad6c3bac550f981054199dcc6234dcdc373e91 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #42ad6c3] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 42ad6c3bac550f981054199dcc6234dcdc373e91 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #42ad6c3] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 256 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 23 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 42ad6c3bac550f981054199dcc6234dcdc373e91 [PR build]

@rolfbjarne
rolfbjarne merged commit ebc9d34 into net11.0 Jul 10, 2026
55 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/issue-25799-remove-startup-hooks-env-workaround branch July 10, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants