Skip to content

Guard against setting empty XCODE_DEVELOPER_DIR_PATH env var#185

Open
rmarinho wants to merge 2 commits into
mainfrom
fix/sdksettings-empty-env-var
Open

Guard against setting empty XCODE_DEVELOPER_DIR_PATH env var#185
rmarinho wants to merge 2 commits into
mainfrom
fix/sdksettings-empty-env-var

Conversation

@rmarinho
Copy link
Copy Markdown
Member

Summary

Adds a null/empty check before setting the XCODE_DEVELOPER_DIR_PATH environment variable in AppleSdkSettings.Init(). Setting an empty string is different from not setting the variable and could confuse downstream tools that check for its presence.

Context

While DeveloperRoot is expected to be non-empty at this point (since foundSdk is true), this defensive guard prevents unexpected behavior if validation logic changes in the future.

Copilot AI review requested due to automatic review settings May 29, 2026 15:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 defensively avoids setting XCODE_DEVELOPER_DIR_PATH when AppleSdkSettings.Init() resolves an empty developer root, preventing downstream tools from treating an empty environment variable as an intentional configured value.

Changes:

  • Adds a null/empty guard before setting XCODE_DEVELOPER_DIR_PATH.

Only set the XCODE_DEVELOPER_DIR_PATH environment variable when
DeveloperRoot is non-empty. If it is empty (defensive case), explicitly
clear the env var to avoid leaving a stale value from a prior Init() call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rmarinho rmarinho force-pushed the fix/sdksettings-empty-env-var branch from 9179f25 to 83a5f40 Compare May 29, 2026 16:00
Comment thread Xamarin.MacDev/AppleSdkSettings.cs Outdated
The foundSdk guard already ensures DeveloperRoot is non-null/empty,
making the defensive check redundant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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