Skip to content

[msbuild] Support devicectl JSON version 5. Fixes #26482. - #26643

Open
rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/fix-26482
Open

rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/fix-26482

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Update Xamarin.MacDev and verify GetAvailableDevices consumes the new properties dictionary.

Fixes #26482.

Update Xamarin.MacDev and verify GetAvailableDevices consumes the new properties dictionary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Fixes #26482.
Copilot AI lite review requested due to automatic review settings September 16, 2026 14:37

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.

🟡 Changes recommended

The parser update and accurate v5 fixture coverage are needed before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds regression coverage for devicectl JSON version 5 in GetAvailableDevices.

Changes:

  • Adds a JSON v5 fixture and parsing test.
  • Exercises nested device properties.
  • Requires the parser update, corrected v5 field shapes, and OSVersion/UDID assertions.
File summaries
File Summary
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetAvailableDevicesTest.cs Adds JSON v5 coverage, but the parser update is missing and the fixture and metadata assertions need correction.
Review details

Suppressed comments (2)

tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetAvailableDevicesTest.cs:781

  • bug — The fixture does not reflect the actual jsonVersion: 5 shape from devicectl list devices: the new dictionary puts the name under properties.state, pairing under properties.connection, and the OS version under properties.software.osVersionNumber (an object with stringValue). Using properties.device and state.osVersionNumber here can let the regression test pass while the parser still fails on Xcode 27 output; base this fixture on a captured v5 payload and cover the actual value shapes.
							"device": {

tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetAvailableDevicesTest.cs:120

  • ⚠️ Test coverage — This regression test does not assert the OSVersion or UDID metadata, so it could pass even if the new parser reads enough data for Description and ItemSpec but fails to populate metadata consumed by MSBuild callers. Add explicit assertions for OSVersion (27.0) and UDID (as the legacy DeviceCtl1 test does).
				Assert.That (task.Devices [0].GetMetadata ("Description"), Is.EqualTo ("Rolf's iPhone 15 - iOS 27.0"), "Device description mismatch.");
				Assert.That (task.Devices [0].GetMetadata ("RuntimeIdentifier"), Is.EqualTo ("ios-arm64"), "Device RuntimeIdentifier mismatch.");
				Assert.That (task.Devices [0].GetMetadata ("Status"), Is.EqualTo ("Paired"), "Device Status mismatch.");
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

@vs-mobiletools-engineering-service2

This comment has been minimized.

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.

🔵 Needs a closer look

The parser update and simulator filtering are missing, and test coverage needs additional assertions.

Review details

Suppressed comments (3)

mk/xamarin.mk:3

  • bugMLAUNCH_NUGET_VERSION controls the unrelated mlaunch NuGet download; GetAvailableDevices references DeviceCtlOutputParser from the external/Xamarin.MacDev project (msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj:40). The JSON v5 parser is in the macios-devtools submodule, so without updating that gitlink the task still uses the legacy parser, the new fixture is discarded, and the production bug remains. Please update the Xamarin.MacDev submodule to the parser commit (and its version-check state) instead of only changing the mlaunch version.
MLAUNCH_NUGET_VERSION=1.1.153

tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetAvailableDevicesTest.cs:119

  • ⚠️ Testing — This verifies the version-5 OS value only indirectly through Description. GetAvailableDevices also publishes the OSVersion metadata, so add a direct assertion for "27.0" here to catch a regression where the description remains correct but the task output metadata is not.
				Assert.That (task.Devices [0].GetMetadata ("Description"), Is.EqualTo ("Rolf's iPhone 15 - iOS 27.0"), "Device description mismatch.");
				Assert.That (task.Devices [0].GetMetadata ("RuntimeIdentifier"), Is.EqualTo ("ios-arm64"), "Device RuntimeIdentifier mismatch.");

tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetAvailableDevicesTest.cs:113

  • bug — Xcode 27 devicectl list devices can include simulator entries marked visibilityClass: "simulators", while this task also queries simctl separately. The updated parser does not preserve/filter visibilityClass, so those simulators will be returned a second time (without the simulator state metadata). Please filter simulator entries in the parser/task and add a v5 fixture covering this case.
		public void DeviceCtlJsonVersion5 ()
		{
			var platform = ApplePlatform.iOS;
			var task = CreateTask (platform, "", DEVICECTL_JSON_VERSION_5);
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@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: 9061b978b17bf82eeae1be1f8590f24e6bc01fc3 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #9061b97] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 264 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 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 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
⚠️ Tests on macOS Golden Gate (27): Tests skipped, incorrect beta version. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 9061b978b17bf82eeae1be1f8590f24e6bc01fc3 [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.

Handle updated json format from devicectl

3 participants