mono/mono · critical

Missing method name in --break command line option

Error message

Missing method name in --break command line option

What it means

When the --break flag is parsed, the driver checks that another argument follows (i+1 < argc). If --break is the last argument on the command line, there is no method-name token and it prints this message and exits(1). --break expects a qualified method name to insert a debugger breakpoint.

Source

Thrown at mono/mini/driver.c:1854

			trace_options = (char*)"";
		} else if (strncmp (argv [i], "--trace=", 8) == 0) {
			trace_options = &argv [i][8];
		} else if (strcmp (argv [i], "--verbose") == 0 || strcmp (argv [i], "-v") == 0) {
			mini_verbose_level++;
		} else if (strcmp (argv [i], "--breakonex") == 0) {
			MonoDebugOptions *opt = mini_get_debug_options ();

			opt->break_on_exc = TRUE;
		} else if (strcmp (argv [i], "--stats") == 0) {
			enable_runtime_stats ();
		} else if (strncmp (argv [i], "--stats=", 8) == 0) {
			enable_runtime_stats ();
			if (mono_stats_method_desc)
				g_free (mono_stats_method_desc);
			mono_stats_method_desc = parse_qualified_method_name (argv [i] + 8);
		} else if (strcmp (argv [i], "--break") == 0) {
			if (i+1 >= argc){
				fprintf (stderr, "Missing method name in --break command line option\n");
				exit (1);
			}
			
			if (!mono_debugger_insert_breakpoint (argv [++i], FALSE))
				fprintf (stderr, "Error: invalid method name '%s'\n", argv [i]);
		} else if (strncmp (argv[i], "--gc-params=", 12) == 0) {
			mono_gc_params_set (argv[i] + 12);
		} else if (strncmp (argv[i], "--gc-debug=", 11) == 0) {
			mono_gc_debug_set (argv[i] + 11);
		} else if (strcmp (argv [i], "--llvm") == 0) {
#ifndef MONO_ARCH_LLVM_SUPPORTED
			fprintf (stderr, "Mono Warning: --llvm not supported on this platform.\n");
#elif !defined(ENABLE_LLVM)
			fprintf (stderr, "Mono Warning: --llvm not enabled in this runtime.\n");
#else
			mono_use_llvm = TRUE;
#endif
		} else if (strcmp (argv [i], "--profile") == 0) {

View on GitHub (pinned to 0f53e9e151)

Solutions

  1. Provide a method name token immediately after --break, e.g. --break MyApp.MyClass:Method.
  2. Quote the whole argument so the shell does not drop empty values.
  3. Validate your argument list programmatically before invoking mono.

Example fix

# before
mono --break app.exe          // --break is last -> exit(1)
# after
mono --break MyApp.Foo:Bar app.exe
Defensive patterns

Strategy: validation

Validate before calling

# Ensure --break is never the final argument
args=( "$@" )
for i in "${!args[@]}"; do
  if [ "${args[$i]}" = "--break" ] && [ $((i+1)) -ge ${#args[@]} ]; then
    echo "--break requires a following method name"; exit 1
  fi
done

Prevention

When it happens

Trigger: Passing 'mono --break' with no following method argument, or a quoting/argv-splitting mistake that leaves --break as the final token.

Common situations: Shell variable for the method name expanding to nothing or being dropped; an argv parser reordering flags so --break ends up last; script concatenation error.

Related errors


AI-assisted analysis of mono/mono@0f53e9e151 (2026-08-13). Data as JSON: /api/errors/02e52ee06027896e. Report an issue: GitHub.