lucasg/Dependencies · warning

Json output is not currently supported when dumping the depe

Error message

Json output is not currently supported when dumping the dependency chain.

What it means

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.

Source

Thrown at Dependencies/Program.cs:775

        }

        public static void DumpModuleReferences(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)
        {
            PEModuleReferences ModuleReferences = new PEModuleReferences(Pe);
            Printer(ModuleReferences);
        }

        public static void DumpDependencyChain(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)
        {
            PeDependencies Deps = new PeDependencies(Pe, recursion_depth);
            Printer(Deps);
        }

        public static void DumpModules(PE Pe, Action<IPrettyPrintable> Printer, int recursion_depth = 0)
        {
            if (Printer == JsonPrinter)
            {
                Console.Error.WriteLine("Json output is not currently supported when dumping the dependency chain.");
                return;
            }

            PeDependencies Deps = new PeDependencies(Pe, recursion_depth);
            Printer(Deps.GetModules);
        }

        public static void DumpUsage()
        {
            string Usage = String.Join(Environment.NewLine,
                "Dependencies.exe : command line tool for dumping dependencies and various utilities.",
                "",
                "Usage : Dependencies.exe [OPTIONS] <FILE>",
                "",
                "Options :",
                "  -h -help : display this help",
                "  -json : activate json output.",
				"  -cache : load and use binary cache in order to prevent dll file locking.",

View on GitHub (pinned to 1997a40000)

Solutions

  1. Drop `-json` for the `-modules` command and parse the default human-readable output instead.
  2. Use `-chain` or `-imports`/`-exports` which do support JSON serialization if machine-readable output is required.
  3. 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.

Example fix

// before: combination silently does nothing but print a notice
// run:  Dependencies.exe -json -modules notepad.exe
// after: pick a JSON-supported command
// run:  Dependencies.exe -json -imports notepad.exe
Defensive patterns

Strategy: validation

Validate before calling

// Validate command/printer compatibility before invoking, mirroring DumpModules' guard.
bool jsonIncompatibleWithModules = export_as_json && command == Program.DumpModules;
if (jsonIncompatibleWithModules)
{
    Console.Error.WriteLine("-json is not supported with -modules; choose -imports/-exports/-chain instead.");
    return;
}

Prevention

When it happens

Trigger: Command line `Dependencies.exe -json -modules <FILE>`: GetObjectPrinter(true) returns JsonPrinter, command is wired to DumpModules, and the `Printer == JsonPrinter` guard trips.

Common situations: Users scripting Dependencies for machine consumption combining `-json` with `-modules` expecting JSON output.

Related errors


AI-assisted analysis of lucasg/Dependencies@1997a40000 (2026-08-13). Data as JSON: /api/errors/682b85330db13d7c. Report an issue: GitHub.