{"record":{"id":"566ae40a6bfbead2","repo":"dotnet/runtime","slug":"fail-s","errorCode":null,"errorMessage":"Fail: %s\n","messagePattern":"Fail: %s\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/hosts/corerun/corerun.cpp","lineNumber":985,"sourceCode":"            pal::ensure_trailing_delimiter(path);\n            THROW_IF_FALSE(path.back() == pal::dir_delim || path.length() == 1);\n            path = W(\"/\");\n            pal::ensure_trailing_delimiter(path);\n            THROW_IF_FALSE(path.back() == pal::dir_delim || path.length() == 1);\n        }\n        {\n            THROW_IF_FALSE(!pal::string_ends_with(W(\"\"), W(\".cd\")));\n            THROW_IF_FALSE(pal::string_ends_with(W(\"ab.cd\"), W(\".cd\")));\n            THROW_IF_FALSE(!pal::string_ends_with(W(\"ab.cd\"), W(\".cde\")));\n            THROW_IF_FALSE(!pal::string_ends_with(W(\"ab.cd\"), W(\"ab.cde\")));\n        }\n        {\n            dotenv::self_test();\n        }\n    }\n    catch (const char_t msg[])\n    {\n        pal::fprintf(stderr, W(\"Fail: %s\\n\"), msg);\n        return EXIT_FAILURE;\n    }\n\n    pal::fprintf(stdout, W(\"Self-test passed.\\n\"));\n    return EXIT_SUCCESS;\n}\n","sourceCodeStart":967,"sourceCodeEnd":992,"githubUrl":"https://github.com/dotnet/runtime/blob/b7130aa5e416e88ac48fafe92bf56a9d64e13c97/src/coreclr/hosts/corerun/corerun.cpp#L967-L992","documentation":"Self-test failure message in corerun's self_test() (corerun.cpp:985). The THROW_IF_FALSE / THROW_IF_TRUE macros throw a char_t string on assertion failure; the catch block at corerun.cpp:983 prints 'Fail: %s' with the failed condition text and returns EXIT_FAILURE. It signals that corerun's built-in argument/PATH/dotenv self-test suite found a regression.","triggerScenarios":"Running `corerun -st`, which sets config.self_test and invokes self_test(). It fails when one of the parse_args scenarios, the pal path/string helpers, or dotenv::self_test() behaves differently than the embedded expectations (see corerun.cpp:904-981).","commonSituations":"A porting change to parse_args, pal helpers, or dotenv broke an assumption baked into the self-test; or a platform-specific pal function (ensure_trailing_delimiter, string_ends_with) regressed. This is a developer/build-time signal, not a normal runtime user error.","solutions":["Read the printed condition string (the macro text) to identify which assertion failed.","Reproduce the specific self_test block in a debugger to see the actual vs expected value.","If a deliberate behavior change caused it, update the affected self_test expectation in lockstep.","If no intended change, bisect recent edits to pal/ or parse_args to find the regression."],"exampleFix":"// before (broken expectation)\nTHROW_IF_FALSE(config.entry_assembly_argc == 0);\n// after (updated to match new parse_args behavior)\nTHROW_IF_FALSE(config.entry_assembly_argc == 1);","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"// self_test uses try/catch(char_t*) internally; nothing the caller adds — just parse the printed condition\n// capture: 'Fail: <condition>' and map it to the failing THROW_IF_FALSE/THROW_IF_TRUE site","preventionTips":["Run `corerun -st` in CI after touching parse_args, pal helpers, or dotenv to catch regressions early.","When changing behavior covered by self_test, update the embedded expectation in the same commit.","Treat the printed condition string as the precise pointer to the broken assertion."],"tags":["corerun","self-test","regression","diagnostics"],"analyzedSha":"b7130aa5e416e88ac48fafe92bf56a9d64e13c97","analyzedAt":"2026-08-07T06:17:13.108Z","schemaVersion":2},"datasetVersion":"2026-08-07T15:17:06.553Z"}