![]() |
#1 |
Участник
|
mfp: X++ Debugging Tips and Tricks #3–Conditional breakpoints
Источник: http://blogs.msdn.com/b/mfp/archive/...eakpoints.aspx
============== The Dynamics AX Debugger doesn’t support conditional breakpoints. Once in a while this limitation can be quite annoying – but there is a simple workaround. The third trick in the series of X++ Debugging Tips and Tricks shows you how. This trick requires code instrumentation – I strongly discourage using this trick on a production system. Only use this trick in a test or development sandbox! By using the breakpoint keyword, you can write X++ logic that triggers a breakpoint exactly as you want. Consider this example. It is a recursive implementation of the mathematical function: Factorial. On a 32 bit system it will overflow when called with a sufficient high value. The example shows how to a breakpoint when an overflow occurs. static void ConditionalBreakpointExample(Args args) { int factorial(int _value) { int result = 1; int prevResult; int i; for (i=1; i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
![]() |
#2 |
Участник
|
Цитата:
There is another way to achieve the same result. You can also insert a no-op line, like i=i; and set a normal breakpoint on that line using F9. This approach has the benefit that only the user setting the breakpoint will hit it – but at the risk of leaving some “silly looking code” behind. In contrast the breakpoint statement triggers a best practice error – so they are easy to clean out again.
Ещё стоит отметить один недостаток ключевого слова breakpoint перед F9. Его нельзя снять в момент отладки. Цитата:
Bonus trick
There is another usage of the breakpoint statement. Sometimes regular breakpoints in forms don’t fire – here the breakpoint statement also comes in handy. Instead of setting a breakpoint using F9 – just type “breakpoint;” in the code. This will trigger the debugger. |
|
|
За это сообщение автора поблагодарили: mazzy (5). |