Skip to content

Use shared SimctlOutputParser from Xamarin.MacDev for simctl JSON parsing#24856

Open
rmarinho wants to merge 7 commits intomainfrom
dev/rumar/use-macios-devtools-simctl-parser
Open

Use shared SimctlOutputParser from Xamarin.MacDev for simctl JSON parsing#24856
rmarinho wants to merge 7 commits intomainfrom
dev/rumar/use-macios-devtools-simctl-parser

Conversation

@rmarinho
Copy link
Member

@rmarinho rmarinho commented Mar 9, 2026

Summary

This PR refactors GetAvailableDevices.RunSimCtlAsync to use the shared SimctlOutputParser from the Xamarin.MacDev submodule (dotnet/macios-devtools) instead of inline JSON parsing.

Replaces #24812 — recreated under dev/ branch prefix so CI pipelines trigger.

What this PR does

  1. Updates the submodule to include the new SimctlOutputParser and model classes (main branch, SHA 10a0c3c)
  2. Replaces inline simctl JSON parsing in RunSimCtlAsync with:
    • SimctlOutputParser.ParseDevices(json) — typed SimulatorDeviceInfo objects
    • SimctlOutputParser.ParseRuntimes(json) — typed SimulatorRuntimeInfo objects
    • SimctlOutputParser.ParseDeviceTypes(json) — typed SimulatorDeviceTypeInfo objects
    • DeviceCtlOutputParser.ParseDevices(json) — typed physical device info
  3. Preserves all business logic — MSBuild metadata, devicetypes lookup, RuntimeIdentifier computation, platform filtering

Build fixes included

  • Bump System.Text.Json to 9.0.4 (NU1605 fix from submodule dependency)
  • Suppress CS0618 for AppleSdkSettings obsolete warnings
  • Fix nullability mismatches (CS8604/CS8620)

Dependencies

Status

  • APPROVED by @rolfbjarne
  • Sim test failures are infrastructure/flaky (not related to our changes) — xamarin-macios-ci main pipeline passed earlier

cc @rolfbjarne

rmarinho and others added 6 commits March 9, 2026 15:52
Refactor GetAvailableDevices.RunSimCtlAsync to use the shared
SimctlOutputParser from the Xamarin.MacDev submodule instead of
inline JSON parsing. This:

- Reuses tested parsing logic (65+ unit tests in macios-devtools)
- Shares the parser across both MSBuild tasks and the MAUI CLI tool
- Keeps devicetypes parsing inline (not yet in shared parser)
- Preserves all MSBuild metadata, filtering, and discarding logic

Depends on dotnet/macios-devtools PR #158 being merged to main.
The submodule currently points to feature/simulator-management.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor GetAvailableDevices to use all three shared parsers:
- SimctlOutputParser.ParseDevices: simulator device extraction
- SimctlOutputParser.ParseRuntimes: runtime extraction
- SimctlOutputParser.ParseDeviceTypes: devicetypes extraction
- DeviceCtlOutputParser.ParseDevices: physical device extraction

This eliminates all inline JSON parsing (System.Text.Json and
Xamarin.Utils JsonExtensions no longer needed in this file).
The only remaining code is MSBuild-specific TaskItem mapping,
platform filtering, RuntimeIdentifier computation, and CanRunArm64.

Net result: -45 lines, zero inline JSON parsing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix NU1605 package downgrade error: Xamarin.MacDev references
System.Text.Json 9.0.4, while Xamarin.MacDev.Tasks pinned 8.0.5.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- XamarinTask: match ICustomLogger nullable signatures (Exception?, object?[])
- GetAvailableDevices: add using Xamarin.Utils for ApplePlatform
- Update submodule to latest (6a2d99b)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AppleSdkSettings was marked [Obsolete] in macios-devtools PR #140
(XcodeLocator). Existing usages in Sdks.cs, CompileAppManifest.cs,
and DetectSdkLocation.cs are intentional pending full migration.
TreatWarningsAsErrors=true promotes the warning to an error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Point submodule from feature/simulator-management branch to main,
which now includes the merged simulator management APIs.

Co-authored-by: Copilot <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.

@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
Copy link
Member

This looks related to the PR:

/Users/builder/azdo/_work/4/s/macios/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/Contents.json : error : Invalid json: Method 'FlushAsync' in type 'System.Text.Json.PooledByteBufferWriter' from assembly 'Xamarin.MacDev.Tasks, Version=26.2.10360.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' does not have an implementation. [/Users/builder/azdo/_work/4/s/macios/tests/linker/dont link/dotnet/MacCatalyst/dont link.csproj]

@rolfbjarne rolfbjarne self-assigned this Mar 9, 2026
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #4243e24] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 4243e241e1c4f698d12a3151a0b7a643585f8b9e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #4243e24] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 4243e241e1c4f698d12a3151a0b7a643585f8b9e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #4243e24] Build failed (Build macOS tests) 🔥

Build failed for the job 'Build macOS tests' (with job status 'Failed')

Pipeline on Agent
Hash: 4243e241e1c4f698d12a3151a0b7a643585f8b9e [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #4243e24] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

5 tests crashed, 56 tests failed, 75 tests passed.

Failures

❌ dotnettests tests (iOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(iOS,"ios-arm6...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(iOS,"iossimul...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(iOS,"ios-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/builder/azdo/_work/3/s/macios/builds/downloads/dotnet-sdk-10.0.300-p...
    • ... and 42 more

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(MacCatalyst,"...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(MacCatalyst,"...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(MacCatalyst,"maccatal...: 'dotnet build' failed with exit code 1
      Full command: /Users/builder/azdo/_work/3/s/macios/builds/downloads/dotnet-sdk-10.0.300-p...
    • ... and 41 more

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(MacOSX,"osx-a...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(MacOSX,"osx-x...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(MacOSX,"osx-arm64;osx...: 'dotnet build' failed with exit code 1
      Full command: /Users/builder/azdo/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.300-p...
    • ... and 38 more

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(TVOS,"tvos-ar...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon_Failure(TVOS,"tvossim...: Failure when comparing error messages:
      Unexpected error message #0:
      Expected: Can't find the AlternateAppIcon 'InexistentAppI...
    • Xamarin.Tests.AppIconTest.AlternateAppIcon(TVOS,"tvos-arm64"): 'dotnet build' failed with exit code 1
      Full command: /Users/builder/azdo/_work/1/s/macios/builds/downloads/dotnet-sdk-10.0.300-p...
    • ... and 36 more

Html Report (VSDrops) Download

❌ introspection tests

5 tests failed, 1 tests passed.

Failed tests

  • introspection/Mac Catalyst/Debug: BuildFailure
  • introspection/iOS - simulator/Debug: BuildFailure
  • introspection/iOS - simulator/Debug (ARM64): BuildFailure
  • introspection/tvOS - simulator/Debug: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • introspection/tvOS - simulator/Debug (ARM64): BuildFailure

Html Report (VSDrops) Download

❌ linker tests

44 tests failed, 0 tests passed.

Failed tests

  • dont link/macOS/Debug: BuildFailure
  • dont link/macOS/Release: BuildFailure
  • dont link/Mac Catalyst/Debug: BuildFailure
  • dont link/Mac Catalyst/Release: BuildFailure
  • dont link/iOS - simulator/Debug: BuildFailure
  • dont link/iOS - simulator/Release: BuildFailure
  • dont link/tvOS - simulator/Debug: BuildFailure
  • dont link/tvOS - simulator/Release: BuildFailure
  • link sdk/macOS/Debug: BuildFailure
  • link sdk/macOS/Release: BuildFailure
  • link sdk/Mac Catalyst/Debug: BuildFailure
  • link sdk/Mac Catalyst/Release: BuildFailure
  • link sdk/iOS - simulator/Debug: BuildFailure
  • link sdk/iOS - simulator/Release: BuildFailure
  • link sdk/tvOS - simulator/Debug: BuildFailure
  • link sdk/tvOS - simulator/Release: BuildFailure
  • link all/macOS/Debug: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link all/macOS/Debug (don't bundle original resources): BuildFailure
  • link all/macOS/Release: BuildFailure
  • link all/Mac Catalyst/Debug: BuildFailure
  • link all/Mac Catalyst/Debug (don't bundle original resources): BuildFailure
  • link all/Mac Catalyst/Release: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • link all/iOS - simulator/Debug: BuildFailure
  • link all/iOS - simulator/Release: BuildFailure
  • link all/iOS - simulator/Debug (don't bundle original resources): BuildFailure
  • link all/tvOS - simulator/Debug: BuildFailure
  • link all/tvOS - simulator/Release: BuildFailure
  • link all/tvOS - simulator/Debug (don't bundle original resources): BuildFailure
  • trimmode copy/macOS/Debug: BuildFailure
  • trimmode copy/macOS/Release: BuildFailure
  • trimmode copy/Mac Catalyst/Debug: BuildFailure
  • trimmode copy/Mac Catalyst/Release: BuildFailure
  • trimmode copy/iOS - simulator/Debug: BuildFailure
  • trimmode copy/iOS - simulator/Release: BuildFailure
  • trimmode copy/tvOS - simulator/Debug: BuildFailure
  • trimmode copy/tvOS - simulator/Release: BuildFailure
  • trimmode link/macOS/Debug: BuildFailure
  • trimmode link/macOS/Release: BuildFailure
  • trimmode link/Mac Catalyst/Debug: BuildFailure
  • trimmode link/Mac Catalyst/Release: BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
  • trimmode link/iOS - simulator/Debug: BuildFailure
  • trimmode link/iOS - simulator/Release: BuildFailure
  • trimmode link/tvOS - simulator/Debug: BuildFailure
  • trimmode link/tvOS - simulator/Release: BuildFailure

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

1 tests failed, 10 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Release (NativeAOT, x64): Crashed

Html Report (VSDrops) Download

❌ msbuild tests

1 tests failed, 1 tests passed.

Failed tests

  • MSBuild tasks tests: Failed (Execution failed with exit code 1)
    • Xamarin.MacDev.Tasks.ACToolTaskTests.AllAppIcons(iOS): #RunTask-ErrorCount
      : error: Invalid json: Method 'FlushAsync' in type 'System.Text.Json.PooledByteBufferWriter' from assembl...
    • Xamarin.MacDev.Tasks.ACToolTaskTests.AllAppIcons(MacCatalyst): #RunTask-ErrorCount
      : error: Invalid json: Method 'FlushAsync' in type 'System.Text.Json.PooledByteBufferWriter' from assembl...
    • Xamarin.MacDev.Tasks.ACToolTaskTests.AllAppIcons(MacOSX): #RunTask-ErrorCount
      : error: Invalid json: Method 'FlushAsync' in type 'System.Text.Json.PooledByteBufferWriter' from assembl...
    • ... and 54 more

Html Report (VSDrops) Download

❌ windows tests

1 tests failed, 2 tests passed.

Failed tests

  • Remote .NET tests/Xamarin.Tests.IncrementalBuildTest.CodeChangeSkipsTargetsOnRemoteWindows(iOS,"iossimulator-arm64",True): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.PluralRuntimeIdentifiersWithRemoteMac(iOS,"ios-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.AppWithLibraryWithResourcesReferenceOnRemoteWindows(iOS,"ios-arm64",False): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.LibraryWithResourcesOnRemoteWindows(iOS,False): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.StripTest(iOS,"ios-arm64","Release"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.BundleStructureWithRemoteMac(iOS,"ios-arm64",All,"Debug"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.PackTest.BindingXcFrameworksProjectOnRemoteWindowsUsingFallback(iOS,True,True,False): Failed: 'dotnet pack' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.PackTest.BindingXcFrameworksProjectOnRemoteWindowsUsingFallback(iOS,True,False,True): Failed: 'dotnet pack' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.AppWithLibraryWithResourcesReferenceOnRemoteWindows(iOS,"ios-arm64",True): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.RemoteTest(iOS,"ios-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.PackTest.BindingXcFrameworksProjectOnRemoteWindowsUsingFallback(iOS,True,True,True): Failed: 'dotnet pack' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.IncrementalBuildTest.CodeChangeSkipsTargetsOnRemoteWindows(iOS,"iossimulator-arm64",False): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.BuildEmbeddedFrameworkInBindingProjectApp(iOS,"iossimulator-arm64"): Failed: 'dotnet build' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.PackTest.BindingXcFrameworksProjectOnRemoteWindowsUsingFallback(iOS,False,False,False): Failed: 'dotnet pack' failed with exit code 1

  • Remote .NET tests/Xamarin.Tests.WindowsTest.PluralRuntimeIdentifiersWithRemoteMac(iOS,"iossimulator-arm64;iossimulator-x64"): Failed: 'dotnet build' failed with exit code 1

Html Report (VSDrops) Download

❌ Tests on macOS Monterey (12) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Ventura (13) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Sequoia (15) tests

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

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

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

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): 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
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 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

Pipeline on Agent
Hash: 4243e241e1c4f698d12a3151a0b7a643585f8b9e [PR build]

@vs-mobiletools-engineering-service2
Copy link
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: 4243e241e1c4f698d12a3151a0b7a643585f8b9e [PR build]

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