Home Cannot bind breakpoint with MDbg (always unbound and ineffective)
Reply: 0

Cannot bind breakpoint with MDbg (always unbound and ineffective)

user3927 Published in July 22, 2018, 5:52 pm

I cannot set any working (not unbound) breakpoints with command line MDbg (.Net Managed Code Debugger) with C# modules compiled with csc on command line as well under Windows 10. I spent an entire day trying to figure out how to fix this to absolutely no avail. Here are detailed steps I took to show this strange trouble.


Installed MDbg with NuGet

nuget install MDbg -Version 0.1.0

And set path to xxx/NuGet/MDbg.0.1.0/tools Then compiled a simple test C# source (tried with .Net frameworks 3.5 and 4.7 with same issue):

csc /debug+ /optimize- test0.cs

Contents of test0.cs:

using System;
using System.Collections.Generic;
namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
           int max;
           try   {max=int.Parse(args[0]);}
           catch {max=222;}
           List<int> primes = CollectPrimesUpTo(max);
           Console.WriteLine(String.Join(", ", primes.ConvertAll(i => i.ToString()).ToArray()));
        static List<int> CollectPrimesUpTo(int max)
            List<int> result = new List<int>();
            for(int i=1; i<=max; i++) {
             int j, sq = (int)Math.Sqrt((double)i);
             for(j=2; j<=sq; j++) {
              if(i % j == 0)
           return result;

Below is an debug session, started under the same folder where test0.cs|.exe|.pdb are located, with different attempts to set breakpoints (many more tried anyway): all unbound and not working because the go command runs programs to its end. [Something strange also is setting path is needed for show command to work. Otherwise you get this ridiculous message: "Error: Source file 'b:_limbo\GUIonCSharpMono-master\test0.cs' not available."]

D:\_limbo\GUIonCSharpMono-master>Mdbg test0 23
MDbg (Managed debugger) v0.0.0.0 started.
Copyright (C) Microsoft Corporation. All rights reserved.
For information about commands type "help";
to exit program type "quit".
run test0 23
STOP: Breakpoint Hit
located at line 9 in test0.cs
[p#:0, t#:0] mdbg> path D:\_limbo\GUIonCSharpMono-master
Path set to: D:\_limbo\GUIonCSharpMono-master
6      class Program
7      {
8          static void Main(string[] args)
9:*        {
10             int max;
11             try   {max=int.Parse(args[0]);}
[p#:0, t#:0] mdbg> x test0
~0. ConsoleApplication1.Program.Main(args)
~1. ConsoleApplication1.Program.CollectPrimesUpTo(max)
~2. ConsoleApplication1.Program..ctor()
~3. ConsoleApplication1.Program.<Main>b__0(i)
[p#:0, t#:0] mdbg> break ~1
Breakpoint #1 unbound (:1!ConsoleApplication1.Program::CollectPrimesUpTo(+0))
[p#:0, t#:0] mdbg> break CollectPrimesUpTo
Breakpoint #2 unbound (::CollectPrimesUpTo(+0))
[p#:0, t#:0] mdbg> break ConsoleApplication1.Program.CollectPrimesUpTo
Breakpoint #3 unbound (ConsoleApplication1.Program::CollectPrimesUpTo(+0))
[p#:0, t#:0] mdbg> break test0.cs:25
Breakpoint #4 unbound (line 25 in test0.cs)
[p#:0, t#:0] mdbg> break
Current breakpoints:
Breakpoint #1 unbound (:1!ConsoleApplication1.Program::CollectPrimesUpTo(+0))
Breakpoint #2 unbound (::CollectPrimesUpTo(+0))
Breakpoint #3 unbound (ConsoleApplication1.Program::CollectPrimesUpTo(+0))
Breakpoint #4 unbound (line 25 in test0.cs)
[p#:0, t#:0] mdbg> go
1, 2, 3, 5, 7, 11, 13, 17, 19, 23
STOP: Process Exited
mdbg> exit

Any help, solution, suggestion, idea, highly appreciated. Thank you.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307333 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO