mono/mono · error

Method name is in a bad format in --break-at-bb command line

Error message

Method name is in a bad format in --break-at-bb command line option.

What it means

For `--break-at-bb`, after the two tokens are present the driver parses the method token with `mono_method_desc_new(argv[i], TRUE)` (include_namespace=TRUE). If that returns NULL the descriptor string is malformed (unparseable method-spec syntax) and the driver exits 1. This is distinct from error 105: that checks whether a method MATCHES; this checks whether the STRING even parses into a MonoMethodDesc.

Source

Thrown at mono/mini/driver.c:2273

			MonoDebugOptions *opt = mini_get_debug_options ();

			opt->break_on_exc = TRUE;
		} else if (strcmp (argv [i], "--break") == 0) {
			if (i+1 >= argc){
				fprintf (stderr, "Missing method name in --break command line option\n");
				return 1;
			}
			
			if (!mono_debugger_insert_breakpoint (argv [++i], FALSE))
				fprintf (stderr, "Error: invalid method name '%s'\n", argv [i]);
		} else if (strcmp (argv [i], "--break-at-bb") == 0) {
			if (i + 2 >= argc) {
				fprintf (stderr, "Missing method name or bb num in --break-at-bb command line option.");
				return 1;
			}
			mono_break_at_bb_method = mono_method_desc_new (argv [++i], TRUE);
			if (mono_break_at_bb_method == NULL) {
				fprintf (stderr, "Method name is in a bad format in --break-at-bb command line option.");
				return 1;
			}
			mono_break_at_bb_bb_num = atoi (argv [++i]);
		} else if (strcmp (argv [i], "--inject-async-exc") == 0) {
			if (i + 2 >= argc) {
				fprintf (stderr, "Missing method name or position in --inject-async-exc command line option\n");
				return 1;
			}
			mono_inject_async_exc_method = mono_method_desc_new (argv [++i], TRUE);
			if (mono_inject_async_exc_method == NULL) {
				fprintf (stderr, "Method name is in a bad format in --inject-async-exc command line option\n");
				return 1;
			}
			mono_inject_async_exc_pos = atoi (argv [++i]);
		} else if (strcmp (argv [i], "--verify-all") == 0) {
			mono_verifier_enable_verify_all ();
		} else if (strcmp (argv [i], "--full-aot") == 0) {
			mono_jit_set_aot_mode (MONO_AOT_MODE_FULL);

View on GitHub (pinned to 0f53e9e151)

Solutions

  1. Use the `Namespace.Class:Method` form with a colon separator: `mono --break-at-bb MyApp.Foo:Bar 3 prog.exe`.
  2. For generic methods, use the supported arity/generic syntax in the descriptor; consult mono_method_desc_new docs.
  3. Test the descriptor against a small tool that calls mono_method_desc_new before launching.

Example fix

# before (dot instead of colon)
mono --break-at-bb MyApp.Foo.Bar 3 prog.exe
# after
mono --break-at-bb MyApp.Foo:Bar 3 prog.exe
Defensive patterns

Strategy: type-guard

Validate before calling

#!/usr/bin/env bash
m="$1"
# mono_method_desc_new expects Namespace.Class:Method
[[ "$m" =~ ^[A-Za-z_][A-Za-z0-9_.]*(\[[^]]*\])?:[A-Za-z_][A-Za-z0-9_]* ]] \
  || { echo "bad method descriptor: $m" >&2; exit 1; }

Type guard

// Method descriptor must parse via mono_method_desc_new(name, TRUE).
// Minimal shape guard: Namespace.Class:Method  (colon separator required)
function looksLikeMethodDesc(s) {
  return /^[A-Za-z_][\w.]*(\[[^\]]*\])?:[A-Za-z_][\w]*$/.test(s);
}

Prevention

When it happens

Trigger: A method-spec string that violates the descriptor grammar (e.g. missing the `:`, stray characters, empty class name). mono_method_desc_new expects a form like `Namespace.Class:Method` (with optional generic/arity syntax).

Common situations: Typing `Namespace.Class.Method` (dot instead of colon), omitting the method portion, or pasting a reflection-style name that the desc parser rejects.

Related errors


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