{"record":{"id":"682b85330db13d7c","repo":"lucasg/Dependencies","slug":"json-output-is-not-currently-supported-when-dumpin","errorCode":null,"errorMessage":"Json output is not currently supported when dumping the dependency chain.","messagePattern":"Json output is not currently supported when dumping the dependency chain\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"Dependencies/Program.cs","lineNumber":775,"sourceCode":"        }\n\n        public static void DumpModuleReferences(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)\n        {\n            PEModuleReferences ModuleReferences = new PEModuleReferences(Pe);\n            Printer(ModuleReferences);\n        }\n\n        public static void DumpDependencyChain(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)\n        {\n            PeDependencies Deps = new PeDependencies(Pe, recursion_depth);\n            Printer(Deps);\n        }\n\n        public static void DumpModules(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)\n        {\n            if (Printer == JsonPrinter)\n            {\n                Console.Error.WriteLine(\"Json output is not currently supported when dumping the dependency chain.\");\n                return;\n            }\n\n            PeDependencies Deps = new PeDependencies(Pe, recursion_depth);\n            Printer(Deps.GetModules);\n        }\n\n        public static void DumpUsage()\n        {\n            string Usage = String.Join(Environment.NewLine,\n                \"Dependencies.exe : command line tool for dumping dependencies and various utilities.\",\n                \"\",\n                \"Usage : Dependencies.exe [OPTIONS] <FILE>\",\n                \"\",\n                \"Options :\",\n                \"  -h -help : display this help\",\n                \"  -json : activate json output.\",\n\t\t\t\t\"  -cache : load and use binary cache in order to prevent dll file locking.\",","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/lucasg/Dependencies/blob/1997a40000b77bd3326cbc33672a7b9f78bb23f3/Dependencies/Program.cs#L757-L793","documentation":"Printed by Program.DumpModules (Program.cs:775) when the requested printer is JsonPrinter. The `-modules` command resolves the whole dependency chain and then hands `PeDependencies.GetModules` (a ModuleEntries dictionary) to the printer; JSON serialization of that graph is intentionally unsupported, so the method writes this notice to stderr and returns without doing anything.","triggerScenarios":"Command line `Dependencies.exe -json -modules <FILE>`: GetObjectPrinter(true) returns JsonPrinter, command is wired to DumpModules, and the `Printer == JsonPrinter` guard trips.","commonSituations":"Users scripting Dependencies for machine consumption combining `-json` with `-modules` expecting JSON output.","solutions":["Drop `-json` for the `-modules` command and parse the default human-readable output instead.","Use `-chain` or `-imports`/`-exports` which do support JSON serialization if machine-readable output is required.","If JSON module info is essential, modify DumpModules to serialize a projection (e.g. a flat list of {ModuleName, Filepath, SearchStrategy}) rather than the whole PeDependencies graph."],"exampleFix":"// before: combination silently does nothing but print a notice\n// run:  Dependencies.exe -json -modules notepad.exe\n// after: pick a JSON-supported command\n// run:  Dependencies.exe -json -imports notepad.exe","handlingStrategy":"validation","validationCode":"// Validate command/printer compatibility before invoking, mirroring DumpModules' guard.\nbool jsonIncompatibleWithModules = export_as_json && command == Program.DumpModules;\nif (jsonIncompatibleWithModules)\n{\n    Console.Error.WriteLine(\"-json is not supported with -modules; choose -imports/-exports/-chain instead.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cross-reference the command set: only -imports, -exports, -chain, -manifest, -sxsentries, -assemblyrefs, -modulerefs, -apisets, -knowndll support JSON; -modules does not.","When scripting, assert the chosen command is JSON-capable before passing -json."],"tags":["cli","json","unsupported-feature","stderr"],"backgroundTag":null,"analyzedSha":"1997a40000b77bd3326cbc33672a7b9f78bb23f3","analyzedAt":"2026-08-13T18:14:41.696Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}