dotnet/maui · error · Exception
No test results found.
Error message
No test results found.
What it means
Thrown inside HandleTestResults when needsNameFix is true (iOS/catalyst runs) and GetFiles for xunit-test-*.xml in the results directory yields no match. XHarness writes its xUnit XML to a file named xunit-test-<timestamp>.xml; absence means the test runner never reached the result-writing stage.
Source
Thrown at eng/devices/devices-shared.cake:247
{
values.Add($"Category={(string)field.GetValue(null)}");
}
}
return values.ToList();
}
void HandleTestResults(string resultsDir, bool testsFailed, bool needsNameFix, string suffix = null)
{
Information($"Handling test results: {resultsDir}");
// catalyst and ios test result files are weirdly named, so fix it up
if(needsNameFix)
{
var resultsFile = GetFiles($"{resultsDir}/xunit-test-*.xml").FirstOrDefault();
if (resultsFile == null)
{
throw new Exception("No test results found.");
}
if (FileExists(resultsFile))
{
Information($"Test results found on {resultsDir}");
MoveFile(resultsFile, resultsFile.GetDirectory().CombineWithFilePath($"testResults{suffix}.xml"));
var logFiles = GetFiles($"{resultsDir}/*.log");
foreach (var logFile in logFiles)
{
if (logFile.GetFilename().ToString().StartsWith("testResults"))
{
// These are log files that have already been renamed
continue;
}
Information($"Log file found: {logFile.GetFilename().ToString()}");
MoveFile(logFile, resultsFile.GetDirectory().CombineWithFilePath($"testResults{suffix}-{logFile.GetFilename()}"));View on GitHub (pinned to f377ff1c5e)
Solutions
- Inspect the *.log files and xharness stdout in resultsDir for the real failure (boot timeout, install error, crash) — the missing XML is a symptom, not the cause.
- Verify resultsDir matches the --output-directory passed to xharness apple test; mismatched paths are the most common cause.
- Re-run with a clean results dir to rule out a leftover file with a different name pattern from a previous run.
- Increase the xharness --launch-timeout if logs show the app started but never finished writing results.
Example fix
// before
var resultsFile = GetFiles($"{resultsDir}/xunit-test-*.xml").FirstOrDefault();
if (resultsFile == null)
throw new Exception("No test results found.");
// after: surface what *is* in the dir so the failure is diagnosable
var resultsFile = GetFiles($"{resultsDir}/xunit-test-*.xml").FirstOrDefault();
if (resultsFile == null)
{
var contents = string.Join(", ", GetFiles($"{resultsDir}/*").Select(f => f.GetFilename().ToString()));
throw new Exception($"No test results found in {resultsDir}. Contents: {contents}");
} Defensive patterns
Strategy: validation
Validate before calling
// Before HandleTestResults, confirm xharness wrote output
var candidate = GetFiles($"{resultsDir}/xunit-test-*.xml");
if (needsNameFix && (candidate == null || !candidate.Any()))
{
var dump = string.Join(", ", GetFiles($"{resultsDir}/*").Select(f => f.GetFilename().ToString()));
throw new Exception($"XHarness produced no results in {resultsDir}. Dir contents: {dump}");
} Prevention
- Keep resultsDir identical to the --output-directory passed to xharness.
- Archive the full results dir (logs included) in CI so missing-XML failures are diagnosable.
- Clean the results dir before each run to avoid confusing stale files with fresh output.
When it happens
Trigger: Calling HandleTestResults after an iOS/catalyst xharness run that crashed, timed out, or was killed before emitting results; passing a resultsDir that points at the wrong folder; the runner writing to a sibling directory because --output-directory was set differently; a prior step deleting the results dir.
Common situations: Simulator boot failure causing xharness to exit before tests start; app install failure on the simulator; a stale results dir from a previous run that was partially cleaned; CI reruns where the results dir path changed between matrix legs.
Related errors
- No device was found to install the app on. See the Setup met
- No device was found to run tests on.
- No simulator was found to run tests on.
- No devices found
- No devices found for version {version}
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/c80c28031f0f429a.
Report an issue: GitHub.