dotnet/runtime · warning

Option %s: missing shared library path

Error message

Option %s: missing shared library path

What it means

Printed by parse_args() when -l / --preload is the LAST token (i >= argc after i++). The option expects a path to a shared library to load before the CLR; none follows. Parsing breaks and returns false.

Source

Thrown at src/coreclr/hosts/corerun/corerun.cpp:818

            string_t prop = argv[i];
            size_t delim_maybe = prop.find(W('='));
            if (delim_maybe == string_t::npos)
            {
                pal::fprintf(stderr, W("Option %s: '%s' missing property value\n"), arg, prop.c_str());
                break;
            }

            string_t key = prop.substr(0, delim_maybe);
            string_t value = prop.substr(delim_maybe + 1);
            config.user_defined_keys.push_back(std::move(key));
            config.user_defined_values.push_back(std::move(value));
        }
        else if (pal::strcmp(option, W("l")) == 0 || (pal::strcmp(option, W("preload")) == 0))
        {
            i++;
            if (i >= argc)
            {
                pal::fprintf(stderr, W("Option %s: missing shared library path\n"), arg);
                break;
            }

            string_t library = argv[i];
            pal::mod_t hMod;
            if (!pal::try_load_library(library, hMod))
            {
                break;
            }
        }
        else if (pal::strcmp(option, W("d")) == 0 || (pal::strcmp(option, W("debug")) == 0))
        {
            config.wait_to_debug = true;
        }
        else if (pal::strcmp(option, W("st")) == 0)
        {
            config.self_test = true;
            return true;

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Supply a full path to the shared library: 'corerun -l /path/libhook.so App.dll'.
  2. Verify the library exists and is loadable for the current platform/architecture.
  3. Drop the -l option if no preload is needed.

Example fix

# before
corerun -l App.dll
# after
corerun -l /opt/hooks/instrumentation.so App.dll
Defensive patterns

Strategy: validation

Validate before calling

# ensure -l/--preload is never the trailing token
if [ "${@: -1}" = "-l" ] || [ "${@: -1}" = "--preload" ]; then
  echo '-l requires a following library path'; exit 2
fi

Prevention

When it happens

Trigger: User runs 'corerun -l' with no library path after. Note: even when a path IS given but pal::try_load_library fails, parsing breaks silently (no message) at line 824-827.

Common situations: Forgotten path; trailing -l; copy-paste that dropped the path.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/303ff130efa9326d. Report an issue: GitHub.