Home > Ax Technical > Adding a breakpoint through code in Dynamics Ax

Adding a breakpoint through code in Dynamics Ax

Every time I see a warning or error, the default place where i place my debugger was at “\Class\Info\add”. I was really not happy of going each time to the same class to place a breakpoint. This week i got rid of it finally 🙂

What I did was develop a small piece of code that will automatically add a breakpoint and called this piece of code from the internal development toolbar that we have. The internal development toolbar is something like Tabax.  You can also do the same and integrate with your own toolbar/ Tabax / Ax Assist.

static void addBreakPoint(Args _args)
{
    container bpCon;
    int       vers, i;
    ;
    //Get the breakpoint
    bpcon = infolog.breakpoint();

   //Version just for reference not really needed
    vers = conpeek(bpCon, i); i++;

    //set the breakpoint
    bpCon += [@"\Classes\Info\add"];    //AOT Path
    bpCon += [1]; //Row number
    bpCon += [true]; //Enabled

    infolog.breakpoint(bpCon);
}

Refer to the article below if you want to know or create toolbar for Ax.
https://kamalblogs.wordpress.com/2007/03/28/a-simple-toolbar-for-dynamics-ax-4-0/

Lately i saw a discussion in one of the russian forums relating to where the code was inspired from. It’s been inspired from “\Forms\SysBreakpoints”.
Advertisements
  1. Phil W
    July 23, 2012 at 3:56 pm

    Here is my version which toggles the breakpoint – the breakpoint is deleted (if toggling “off”), but with a slight modification it could be disabled instead.

    static void toggleInfologBreakpoint()
    {
    container bpCon;
    boolean bpFound;
    int a;

    #define.aotpath(@”\Classes\Info\add”)
    #define.row(1)
    ;

    bpcon = infolog.breakpoint();

    a = conFind(bpCon, #aotpath);

    bpFound = a>0 && conPeek(bpCon,a+1)==#row;

    if (bpFound)
    {
    bpCon = conDel(bpCon, a, 3);
    }
    else
    {
    bpCon += [#aotpath]; // AOT path
    bpCon += [#row]; // row number
    bpCon += [true]; // enabled
    }

    infolog.breakpoint(bpCon);

    if (bpFound)
    {
    box::info(strFmt(@”Breakpoint removed from %1() @ line %2.”, #aotpath, #row));
    }
    else
    {
    box::info(strFmt(@”Breakpoint added to %1() @ line %2.”, #aotpath, #row));
    }
    }

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: