{"record":{"id":"bb3541a32e890a95","repo":"dotnet/maui","slug":"some-test-categories-failed-to-complete-string-j","errorCode":null,"errorMessage":"Some test categories failed to complete: {string.Join(\", \", failedCategories)}. Expected {completedCategories.Count + failedCategories.Count} categories, but {failedCategories.Count} failed.","messagePattern":"Some test categories failed to complete: (.+?)\\. Expected (.+?) categories, but (.+?) failed\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"eng/devices/windows.cake","lineNumber":637,"sourceCode":"\t}\n\n\t// Clean up the test categories file\n\tif (FileExists(testsToRunFile))\n\t{\n\t\tDeleteFile(testsToRunFile);\n\t}\n\n\t// Check if we have any test result files at all\n\tvar actualResultFiles = System.IO.Directory.GetFiles(testResultsPath, \"TestResults-*.xml\");\n\tif (actualResultFiles.Length == 0)\n\t{\n\t\tthrow new Exception($\"No test result files found. All test processes may have crashed or failed to start.\");\n\t}\n\n\t// If we're running Controls tests, validate we have results for expected categories\n\tif (isControlsProjectTestRun && failedCategories.Any())\n\t{\n\t\tthrow new Exception($\"Some test categories failed to complete: {string.Join(\", \", failedCategories)}. Expected {completedCategories.Count + failedCategories.Count} categories, but {failedCategories.Count} failed.\");\n\t}\n\n\t// Check for test failures in the result files\n\tforeach(var file in actualResultFiles)\n\t{\n\t\tvar failed = XmlPeek(file, \"/assemblies/assembly[@failed > 0 or @errors > 0]/@failed\");\n\t\tif (!string.IsNullOrEmpty(failed)) {\n\t\t\tthrow new Exception($\"At least {failed} test(s) failed in {System.IO.Path.GetFileName(file)}.\");\n\t\t}\n\t}\n\n\tInformation($\"✓ All test executions completed successfully with {actualResultFiles.Length} result file(s)\");\n});\n\nTask(\"build\")\n\t.IsDependentOn(\"buildOnly\");\n\nTask(\"test\")","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/eng/devices/windows.cake#L619-L655","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the per-category '✗ ... failed or timed out' Error lines to identify which categories failed, then run those categories individually to reproduce.","If failures are timeouts, raise the per-category timeout passed to LaunchPackagedAndWait (480) for the slow categories or optimize the tests.","Verify the expectedResultFile naming (TestResults-<PACKAGEID with . -> _>_<category>.xml) matches the app's actual output file names.","Re-run locally with --test-filter to isolate the failing categories and capture their crash output."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before final throw, separate timeouts from missing files for clarity\nif (isControlsProjectTestRun && failedCategories.Any())\n    throw new Exception($\"Categories failed: {string.Join(\", \", failedCategories)}. Run them individually with --test-filter to reproduce.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Tune the per-category timeout for known-slow categories.","Verify expectedResultFile naming matches the app's output for each category.","Re-run failing categories in isolation to distinguish crashes from timeouts."],"tags":["cake","windows","test-results","categories","timeout","device-tests"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}