Skip to content

[msbuild] Show a better error for invalid SupportedOSPlatformVersion values. Fixes #23626 - #26488

Open
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/issue-23626-show-a-better-error-with-invalid-support-636dd4
Open

[msbuild] Show a better error for invalid SupportedOSPlatformVersion values. Fixes #23626#26488
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/issue-23626-show-a-better-error-with-invalid-support-636dd4

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Validate SupportedOSPlatformVersion and MinSupportedOSPlatformVersion before writing linker options.

This prevents embedded whitespace such as a newline from producing a confusing linker "No equals sign" error.

Fixes #23626

🤖 Pull request created by Copilot

rolfbjarne and others added 2 commits August 28, 2026 00:26
…formVersion values containing whitespace

A value with an embedded newline (e.g. from an XML formatting mistake)
would previously pass Version.TryParse successfully, but later break
the line-based custom-linker-options.txt file, producing a confusing
'No equals sign' error. Validate up front and report a clear error
instead.

Fixes #23626

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 655532d6-e35b-427a-bf9e-3ada6eb79ec6
Copilot AI lite review requested due to automatic review settings August 28, 2026 09:07

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

This PR improves the MSBuild UX for invalid SupportedOSPlatformVersion / MinSupportedOSPlatformVersion values by failing early with a targeted diagnostic when those properties contain whitespace (notably newlines), preventing downstream linker-option parsing errors like “No equals sign”.

Changes:

  • Validate SupportedOSPlatformVersion and MinSupportedOSPlatformVersion for embedded whitespace before using them during app manifest compilation.
  • Add a new localized error string (E7187) for the whitespace validation failure.
  • Add a regression test covering a newline-prefixed SupportedOSPlatformVersion value.

Reviewed changes

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

File Description
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs Adds a regression test asserting the new error message for whitespace in SupportedOSPlatformVersion.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs Adds early validation to catch whitespace-containing version values and emit a clear error instead of producing broken downstream option files.
msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx Introduces the new E7187 error string used by the task.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +309 to +312
if (value.Any (char.IsWhiteSpace)) {
Log.LogError (MSBStrings.E7187 /* The value '{0}' for the property '{1}' is not a valid version number, because it contains whitespace. */, value, propertyName);
return false;
}
Comment on lines +144 to +148
task.SupportedOSPlatformVersion = "\n13.0";

ExecuteTask (task, expectedErrorCount: 1);
Assert.That (Engine.Logger.ErrorEvents [0].Message, Is.EqualTo ("The value '\n13.0' for the property 'SupportedOSPlatformVersion' is not a valid version number, because it contains whitespace."));
}
@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: 45951d358cb85538af49f1d46df3156909d9ee33 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #45951d3] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 1 tests failed, 201 tests passed.

Failures

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-arm64 monotouch-test: Failed (exit code 137)
    • No test failure details available. Output tail:
      • 2026-08-28 02:57:46.687 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.704 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.720 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.736 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.752 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.769 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.785 monotouchtest[91069:43841607] CFSocketSetAddress listen failure: 102
      • 2026-08-28 02:57:46.834 monotouchtest[91069:43841249] CFSocketSetAddress listen failure: 102
      • Execution timed out after 600 seconds.
      • Execution completed with exit code 137

Html Report (VSDrops) Download

Successes

✅ 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 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 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 Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ 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

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 45951d358cb85538af49f1d46df3156909d9ee33 [PR build]

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.

Show a better error with invalid SupportedOSPlatformVersion values

3 participants