Skip to content

[msbuild] Revamp finding a simulator to use when running an app in the simulator. Fixes #25112.#25129

Merged
rolfbjarne merged 12 commits intomainfrom
dev/rolf/msbuild-exact-simruntime-not-available
Apr 14, 2026
Merged

[msbuild] Revamp finding a simulator to use when running an app in the simulator. Fixes #25112.#25129
rolfbjarne merged 12 commits intomainfrom
dev/rolf/msbuild-exact-simruntime-not-available

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented Apr 9, 2026

In the GetMlaunchArguments task, instead of repeating what the GetAvailableDevices task does, just run the GetAvailableDevices task and pass the resulting devices to the GetMlaunchArguments task. Then GetMlaunchArguments can just pick the first applicable one, which should work fine.

Fixes #25112.

rolfbjarne and others added 7 commits April 9, 2026 16:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 updates the msbuild “run/install via mlaunch” pipeline for iOS/tvOS to rely on ComputeAvailableDevices/GetAvailableDevices output for device selection, instead of re-deriving simulator selection logic inside GetMlaunchArguments. This is intended to avoid selecting non-existent simulator runtimes (regression reported in #25112).

Changes:

  • Pass @(Devices) / @(DiscardedDevices) from ComputeAvailableDevices into GetMlaunchArguments, and ensure the relevant targets depend on ComputeAvailableDevices.
  • Update GetMlaunchArguments to pick the first available simulator (UDID-based) from the provided device list and improve “no devices” diagnostics.
  • Add/adjust unit tests to reflect UDID-based simulator selection and the new error behavior.

Reviewed changes

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

File Description
msbuild/Xamarin.MacDev.Tasks/Tasks/GetMlaunchArguments.cs Adds task inputs for available/discarded devices; changes simulator selection to use first provided simulator UDID; improves error/help output.
dotnet/targets/Microsoft.Sdk.Mobile.targets Wires ComputeAvailableDevices into run/help/install argument computation and passes device item groups to GetMlaunchArguments.
tests/dotnet/UnitTests/MlaunchTest.cs Makes tests tolerate environments with no devices and updates expected simulator argument pattern to UDID-based selection.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetMlaunchArgumentsTaskTests.cs Adds task-level tests for selecting the first simulator and for improved error/help messaging when devices are missing.
Comments suppressed due to low confidence (1)

msbuild/Xamarin.MacDev.Tasks/Tasks/GetMlaunchArguments.cs:85

  • GetDeviceTypes() references onlyExact, but that parameter was removed from the method signature. This is currently an undefined identifier and will fail to compile. Either restore the bool onlyExact parameter (and update call sites), or remove the conditional and decide the intended product-family filtering behavior for iPhone apps (iPhone-only vs iPhone+iPad).
			// Which product family are we looking for?
			string [] productFamilies;
			switch (DeviceType) {
			case IPhoneDeviceType.IPhone: // if we're looking for an iPhone, an iPad also works
				productFamilies = onlyExact ? ["iPhone"] : ["iPhone", "iPad"];
				break;
			case IPhoneDeviceType.IPad:

Comment thread msbuild/Xamarin.MacDev.Tasks/Tasks/GetMlaunchArguments.cs Outdated
Comment thread tests/dotnet/UnitTests/MlaunchTest.cs
@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.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

…rgumentsTaskTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

@rolfbjarne rolfbjarne marked this pull request as ready for review April 13, 2026 08:05
@rolfbjarne rolfbjarne requested a review from mauroa as a code owner April 13, 2026 08:05
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

@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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #81eebbf] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 81eebbf2c4cc3fc05ac39419be17a4d90d87b9e8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #81eebbf] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 81eebbf2c4cc3fc05ac39419be17a4d90d87b9e8 [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: 81eebbf2c4cc3fc05ac39419be17a4d90d87b9e8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #81eebbf] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 81eebbf2c4cc3fc05ac39419be17a4d90d87b9e8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #81eebbf] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 156 tests passed 🎉

Tests counts

✅ 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 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 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
✅ 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 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
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 81eebbf2c4cc3fc05ac39419be17a4d90d87b9e8 [PR build]

@rolfbjarne rolfbjarne merged commit 8166e00 into main Apr 14, 2026
48 checks passed
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.

[CLI] Running projects on terminal targeting iOS fails with MSB3073 error

5 participants