dotnet/maui · error · Exception
Could not find total or inconclusive test count in test resu
Error message
Could not find total or inconclusive test count in test results.
What it means
Thrown by FailRunOnOnlyInconclusiveTests when XmlPeek for the '/assemblies/assembly/@total' attribute on the test results file returns null. The function relies on xUnit-style XML results; if the total attribute (or the file/structure) is absent, it cannot determine whether the run was real.
Source
Thrown at eng/devices/devices-shared.cake:148
return GetDirectories($"{directory}/*.app").Select(dir => dir.FullPath);
}
IEnumerable<string> FindApksInDirectory(DirectoryPath directory)
{
Information($"Looking for .apk files in {directory}");
return GetFiles($"{directory}/*-Signed.apk").Select(file => file.FullPath);
}
void FailRunOnOnlyInconclusiveTests(string testResultsFile)
{
// When all tests are inconclusive the run does not fail, check if this is the case and fail the pipeline so we get notified
var totalTestCount = XmlPeek(testResultsFile, "/assemblies/assembly/@total");
var inconclusiveTestCount = XmlPeek(testResultsFile, "/assemblies/assembly/@inconclusive");
if (totalTestCount == null)
{
throw new Exception("Could not find total or inconclusive test count in test results.");
}
if (totalTestCount.Equals(inconclusiveTestCount))
{
throw new Exception("All tests are marked inconclusive, no tests ran. There is probably something wrong with running the tests.");
}
}
void CleanResults(string resultsDir)
{
Information($"Cleaning test results: {resultsDir}");
if (!IsCIBuild())
{
CleanDirectories(resultsDir);
}
else
{
// Because we retry on CI we don't want to delete the previous failuresView on GitHub (pinned to f377ff1c5e)
Solutions
- Confirm testResultsFile exists and is a complete xUnit-format XML with an <assemblies><assembly total="..."> root.
- If using a different runner, configure it to emit xUnit XML, or adapt the XPath to the actual schema.
- Re-run the tests to regenerate a valid results file before this guard runs.
- Check for truncation/encoding issues (BOM, partial write) if the file exists but peek fails.
Defensive patterns
Strategy: validation
Validate before calling
if (!FileExists(testResultsFile))
throw new Exception($"Test results file not found: {testResultsFile}");
var total = XmlPeek(testResultsFile, "/assemblies/assembly/@total");
if (total == null)
throw new Exception($"'{testResultsFile}' is missing /assemblies/assembly/@total — not xUnit XML or incomplete."); Type guard
bool IsXUnitResultsXml(string file) {
if (!FileExists(file)) return false;
return XmlPeek(file, "name(/assemblies/assembly)") != null;
} Prevention
- Configure the runner to emit xUnit XML format consistently.
- Verify the results file exists and is non-empty before peeking.
- Guard against concurrent/truncated writes by checking file completeness.
When it happens
Trigger: XmlPeek(testResultsFile, "/assemblies/assembly/@total") returns null — the results file is missing, empty, not XML, or uses a schema without an /assemblies/assembly/@total attribute.
Common situations: The test results path points at a non-existent or incompletely-written file; the runner emitted TRX (VSTest) instead of xUnit XML; the file is from a different test framework; a concurrent write left the XML malformed.
Related errors
- All tests are marked inconclusive, no tests ran. There is pr
- No test result files found. All test processes may have cras
- At least {failed} test(s) failed in {System.IO.Path.GetFileN
- Unexpected platform (expected: android) in device: {deviceDe
- Unexpected device type (expected: device|emulator) in device
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/50efb3fa5463fdd6.
Report an issue: GitHub.