AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.11.2013, 03:16   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
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, напишите личное сообщение администратору.
Старый 20.11.2013, 11:18   #2  
S.Kuskov is offline
S.Kuskov
Участник
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
3,443 / 1781 (66) ++++++++
Регистрация: 28.04.2007
Адрес: Калуга
Цитата:
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 это то что F9 действует локально у разработчика, поставившего эту точку останова, а ключевое слово breakpoint у всех пользователей. Если у пользователя не установлен дебагер, то произойдет ошибка.

Ещё стоит отметить один недостаток ключевого слова 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.
По опыту, там где не работает F9 (в методах контрола формы например), то и ключевое слово breakpoint там не сработает. В таких случаях помогает kamalblogs: Debugging form controls in Dynamics Ax
За это сообщение автора поблагодарили: mazzy (5).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
mfp: X++ Debugging Tips and Tricks #2 – xSession::xppCallStack() Blog bot DAX Blogs 6 23.11.2015 11:37
mfp: X++ Debugging Tips and Tricks Blog bot DAX Blogs 2 24.09.2013 13:01
mfp: X++ Debugging Tips and Tricks #1 – Breakpoint in Info.add() Blog bot DAX Blogs 1 24.09.2013 11:00
sumitax: EP Debugging Tips and Tricks –Part III Blog bot DAX Blogs 0 13.10.2010 14:05
sumitax: EP Debugging Tips and Tricks –Part II Blog bot DAX Blogs 0 30.09.2010 09:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 01:27.