[msbuild] Revamp finding a simulator to use when running an app in the simulator. Fixes #25112.#25129
Conversation
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>
There was a problem hiding this comment.
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)fromComputeAvailableDevicesintoGetMlaunchArguments, and ensure the relevant targets depend onComputeAvailableDevices. - Update
GetMlaunchArgumentsto 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()referencesonlyExact, but that parameter was removed from the method signature. This is currently an undefined identifier and will fail to compile. Either restore thebool onlyExactparameter (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:
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
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: 2 pipeline(s) require an authorized user to comment /azp run to run. |
…t-simruntime-not-available
|
Azure Pipelines: 2 pipeline(s) require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: 2 pipeline(s) require an authorized user to comment /azp run to run. |
✅ [CI Build #81eebbf] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #81eebbf] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #81eebbf] Build passed (Build macOS tests) ✅Pipeline on Agent |
🚀 [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 macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
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.