dotnet/maui · error · Exception

Some test categories failed to complete: {string.Join(", ",

Error message

Some test categories failed to complete: {string.Join(", ", failedCategories)}. Expected {completedCategories.Count + failedCategories.Count} categories, but {failedCategories.Count} failed.

What it means

Thrown in final validation for Controls test runs when failedCategories is non-empty: one or more test categories either did not complete (LaunchPackagedAndWait/StartProcess returned false / timed out) or did not produce their expected TestResults-<package>_<category>.xml file. The message lists the failed categories and the expected-vs-failed counts so you can see how much of the suite failed.

Source

Thrown at eng/devices/windows.cake:637

	}

	// Clean up the test categories file
	if (FileExists(testsToRunFile))
	{
		DeleteFile(testsToRunFile);
	}

	// Check if we have any test result files at all
	var actualResultFiles = System.IO.Directory.GetFiles(testResultsPath, "TestResults-*.xml");
	if (actualResultFiles.Length == 0)
	{
		throw new Exception($"No test result files found. All test processes may have crashed or failed to start.");
	}

	// If we're running Controls tests, validate we have results for expected categories
	if (isControlsProjectTestRun && failedCategories.Any())
	{
		throw new Exception($"Some test categories failed to complete: {string.Join(", ", failedCategories)}. Expected {completedCategories.Count + failedCategories.Count} categories, but {failedCategories.Count} failed.");
	}

	// Check for test failures in the result files
	foreach(var file in actualResultFiles)
	{
		var failed = XmlPeek(file, "/assemblies/assembly[@failed > 0 or @errors > 0]/@failed");
		if (!string.IsNullOrEmpty(failed)) {
			throw new Exception($"At least {failed} test(s) failed in {System.IO.Path.GetFileName(file)}.");
		}
	}

	Information($"✓ All test executions completed successfully with {actualResultFiles.Length} result file(s)");
});

Task("build")
	.IsDependentOn("buildOnly");

Task("test")

View on GitHub (pinned to f377ff1c5e)

Solutions

  1. Read the per-category '✗ ... failed or timed out' Error lines to identify which categories failed, then run those categories individually to reproduce.
  2. If failures are timeouts, raise the per-category timeout passed to LaunchPackagedAndWait (480) for the slow categories or optimize the tests.
  3. Verify the expectedResultFile naming (TestResults-<PACKAGEID with . -> _>_<category>.xml) matches the app's actual output file names.
  4. Re-run locally with --test-filter to isolate the failing categories and capture their crash output.
Defensive patterns

Strategy: validation

Validate before calling

// Before final throw, separate timeouts from missing files for clarity
if (isControlsProjectTestRun && failedCategories.Any())
    throw new Exception($"Categories failed: {string.Join(", ", failedCategories)}. Run them individually with --test-filter to reproduce.");

Prevention

When it happens

Trigger: A category's app run timed out (e.g. exceeded the 480s per-category timeout); the app launched but crashed mid-category before writing that category's result file; the expectedResultFile path for a category does not match what the app writes; intermittent instability affecting only some categories.

Common situations: A flaky/slow category hitting the per-category timeout; a memory leak causing later categories to crash; a recent code change breaking specific categories; PACKAGEID replacement producing a result-file name mismatch for some categories.

Related errors


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