dotnet/maui · error · Exception
No simulator was found to run tests on.
Error message
No simulator was found to run tests on.
What it means
Thrown in InstallIpa's finally block for the simulator branch: GetUDID returned a UDID, but that UDID is not present in ListAppleSimulators() results. The simulator XHarness selected exists in its device list but is not enumerable/available for the run — typically a stale UDID, a simulator that failed to boot, or a mismatch between the XHarness device query and the simulator listing source.
Source
Thrown at eng/devices/ios.cake:443
}
else
{
throw new Exception("No device was found to run tests on.");
}
iosVersionToRun = DEVICE_VERSION;
Information("The device to run tests: {0} {1}", DEVICE_NAME, iosVersionToRun);
}
else
{
var UDID = GetUDID(testDevice, dotnetToolPath);
var sims = ListAppleSimulators();
var simXH = sims.Where(s => s.UDID == UDID).FirstOrDefault();
if (simXH == null)
{
throw new Exception("No simulator was found to run tests on.");
}
deviceToRun = simXH.UDID;
DEVICE_NAME = simXH.Name;
Information("The emulator to run tests: {0} {1}", simXH.Name, simXH.UDID);
}
Information("The platform version to run tests: {0}", iosVersionToRun);
SetEnvironmentVariable("DEVICE_UDID", deviceToRun);
SetEnvironmentVariable("DEVICE_NAME", DEVICE_NAME);
SetEnvironmentVariable("PLATFORM_VERSION", iosVersionToRun);
SetEnvironmentVariable("HEADLESS", headless.ToString());
}
}
string GetUDID(string testDevice, string tool)
{
Information("Looking for simulator: {0}", testDevice);View on GitHub (pinned to f377ff1c5e)
Solutions
- Run 'xcrun simctl list' and confirm the expected UDID appears and the simulator is not in an invalid state; boot it manually if needed.
- Ensure no parallel cleanup task resets simulators between GetUDID and ListAppleSimulators (disable --cleanup during debugging).
- Match the simulator target name exactly to an installed runtime; a missing runtime makes XHarness return a UDID for a simulator simctl won't list.
- Update the Cake.AppleSimulator addin and XHarness to compatible versions if their listings diverge.
Defensive patterns
Strategy: validation
Validate before calling
// Cross-check the UDID against the simulator listing before using it
var UDID = GetUDID(testDevice, dotnetToolPath);
var sims = ListAppleSimulators();
if (!sims.Any(s => s.UDID == UDID))
throw new Exception($"Simulator UDID {UDID} not in current listing; it may have been reset. Available: {string.Join(", ", sims.Select(s => s.UDID))}"); Prevention
- Disable simulator cleanup during debugging to avoid UDID churn between calls.
- Boot the target simulator explicitly before running tests.
- Keep XHarness and the Cake.AppleSimulator addin at compatible versions.
When it happens
Trigger: GetUDID returns a UDID from 'xharness apple device <testDevice>' but ListAppleSimulators() (often backed by Cake.AppleSimulator / simctl) does not include it; the simulator was deleted or reset between the two calls; a simulator name target whose UDID changed after a reset; simctl listing filtered out a shutting-down simulator.
Common situations: Simulator reset/cleanup between runs changing UDIDs; XHarness and the Cake.AppleSimulator addin reading slightly different simulator states; a simulator stuck in 'Shutdown' that XHarness lists but simctl marks unavailable; version skew between XHarness and the simulator tooling.
Related errors
- No device was found to install the app on. See the Setup met
- No device was found to run tests on.
- No test results found.
- No devices found
- No devices found for version {version}
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/723ce72c38de23a7.
Report an issue: GitHub.