dotnet/maui · error · Exception

No devices found for version {version}

Error message

No devices found for version {version}

What it means

Thrown in GetDevices when devices were enumerated (list non-empty) but none matched the requested iOS major version. The loop parses each device line with a regex capturing name/UDID/version/OS, and only sets DEVICE_UDID when version.Contains(deviceVersion major). If no device's major version matches the requested version, DEVICE_UDID stays empty.

Source

Thrown at eng/devices/ios.cake:595

			Information("DeviceName:{0} udid:{1} version:{2} os:{3}", deviceName, deviceUdid, deviceVersion, deviceOS);
			if (version.Contains(deviceVersion.Split(".")[0]))
			{
				Information("We want this device: {0} {1} because it matches {2}", deviceName, deviceVersion, version);
				DEVICE_UDID = deviceUdid;
				DEVICE_VERSION = deviceVersion;
				DEVICE_NAME = deviceName;
				DEVICE_OS = deviceOS;
				break;
			}
		}
		else
		{
			Information("No match found for {0}", stringToTest);
		}
	}
	if (string.IsNullOrEmpty(DEVICE_UDID))
	{
		throw new Exception($"No devices found for version {version}");
	}
}

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Check the 'Device:' Information lines and the 'No match found' warnings to see what versions were actually seen, then connect a device on the requested major version.
  2. Pass --apiversion matching a connected device's major version (e.g. --apiversion=17 for an iOS 17 device).
  3. If lines show as 'No match found', the regex at line 569 may not match the current XHarness output format — update it or capture the raw line for debugging.
  4. Run on a simulator instead if no physical device matches the required version.

Example fix

// before: major-version-only match, easy to miss the right device
if (version.Contains(deviceVersion.Split(".")[0]))

// after: log candidates and compare explicitly
var deviceMajor = deviceVersion.Split(".")[0];
Information($"Candidate {deviceName} iOS {deviceVersion} (major {deviceMajor}) vs requested {version}");
if (version == deviceMajor || version.StartsWith(deviceMajor + "."))
Defensive patterns

Strategy: validation

Validate before calling

// Before GetDevices, list available device versions and compare to the request
// run 'xharness apple state', parse versions, then:
if (!availableVersions.Any(v => v.StartsWith(requestedVersion)))
    throw new Exception($"No connected device on iOS {requestedVersion}; available: {string.Join(", ", availableVersions)}");

Prevention

When it happens

Trigger: Requesting tests on iOS 18 (--apiversion=18 or DefaultVersion) when the connected device runs iOS 17 or 16; a device present but the regex not matching its line format (so it's skipped as 'No match found'); multiple devices connected, none on the right version.

Common situations: DefaultVersion updated in the repo but the lab devices not yet upgraded; developer's personal device on a different iOS; XHarness output format change breaking the regex so device lines parse as non-matches; requesting a version substring that matches no device's major version.

Related errors


AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13). Data as JSON: /api/errors/0dc65ccbcf6ca358. Report an issue: GitHub.