Elusive breakpoint
bob_up
Member Posts: 155
I set a breakpoint using the code editor. The breakpoint is on a line of code following an 'IF ... THEN' statement as follows :
IF ("Item No." = 'XYZ') and ("Lot No." = 'ABC') THEN
BEGIN
MESSAGE("Item No.");
END;
The breakpoint is on the line
MESSAGE("Item No.");
I set the debugger to 'Active' but not 'Breakpoint on triggers'. When I run my application it stops on a line of code a few lines further on from where I set my breakpoint. If I try and remove the 'new' breakpoint in the debugger and replace it on the line of code I want it on, the editor beeps and refuses to let me do it, like it isnt a valid line of code.
It is as if the code, the breakpoints and the debugger are out of synch. in some way. Is there some way to resolve this ?
IF ("Item No." = 'XYZ') and ("Lot No." = 'ABC') THEN
BEGIN
MESSAGE("Item No.");
END;
The breakpoint is on the line
MESSAGE("Item No.");
I set the debugger to 'Active' but not 'Breakpoint on triggers'. When I run my application it stops on a line of code a few lines further on from where I set my breakpoint. If I try and remove the 'new' breakpoint in the debugger and replace it on the line of code I want it on, the editor beeps and refuses to let me do it, like it isnt a valid line of code.
It is as if the code, the breakpoints and the debugger are out of synch. in some way. Is there some way to resolve this ?
0
Answers
-
I always set it a few lines before I want it to stop and F8 until I get to where I want to be. Annoying, but that's NAV. Maybe there's a better way neither of us know about.0
-
That sounds wise, except I want to only stop if a certain condition is met. This is a big update process and I want to look at a specific record which is causing a problem.
I have resolved this now by changing the code to
IF ("Item No." = 'XYZ') and ("Lot No." = 'ABC') THEN
BEGIN
MESSAGE("Item No.");
MESSAGE("Item No.");
MESSAGE("Item No.");
END;
and setting a breakpoint on each of the lines which say
MESSAGE("Item No.");
I just wondered if there was a proper solution.0 -
You've set breakpoint in the right place, on the line with MESSAGE function, not on the one with IF ... THEN.
Sometimes the problem with displaying breakpoint dot in wrong line is caused by commented lines of code somewhere above. Try to Remove them and see if the breakpoint works as expected. Another example is when you use construction likeIF .... THEN MESSAGE(...)
(two C/AL statements on the same line - which is actually your case) instead ofIF .... THEN MESSAGE(...)
I would suggest workaround like that:IF ("Item No." = 'XYZ') THEN IF ("Lot No." = 'ABC') THEN MESSAGE("Item No.");and setting breakpoint on the line with MESSAGE("Item No.");
Regards,
SlawekSlawek Guzek - www.yitron.co.uk
Business Central, MS SQL Server, Wherescape RED;0 -
Thank you Slawek. I think I can call this [SOLVED] now, although I realise these are just workarounds ...
I cant afford to spend any more time looking for a more satisfying solution.
0 -
only a tip:
sometimes when you set a breakpoint on debugger or in the Code editor a message is dispayed: "Breakpoint still exists" (or so).
All Breakpoints are stored in the table Breakpoint. To see the values of this table, you can create a form on this table.
regardsDo you make it right, it works too!0 -
Rewrite the code like this:
IF ("Item No." = 'XYZ') and ("Lot No." = 'ABC') THEN BEGIN MESSAGE("Item No."); END;Run the debugger with 'breakpoint on triggers' turned on. When you get to this piece of code, put your cursor on the line you need and hit F9. If a breakpoint marker appears, you'll know that it is a good point to set one. If it then doesn't stop when you want, set it one line down. It will take just a minute to figure out where to set it.
It's annoying, but eventually you will find the right line to set the breakpoint. It's just the way that it is, sometimes the breakpoint does not align exactly with the code. It has been like that at least since version 2.01 when I started working with Navision.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions


