Показать сообщение отдельно
Старый 02.10.2013, 15:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
mfp: X++ Debugging Tips and Tricks #2 – xSession::xppCallStack()
Источник: http://blogs.msdn.com/b/mfp/archive/...callstack.aspx
==============


In the first trick we saw how to set a breakpoint in the add method on the info class. This enables us to get the context of a single error.   But sometimes error messages come in hoards and stepping through each of them is not practical. Suppose you have hundreds or even thousands of errors occurring, and you want to trace where they are coming from. This trick shows you how.

This trick requires code instrumentation – I will strongly discourage using this trick on a production system. Only use this trick in a test or development sandbox!        
       
The system APIs available in Dynamics AX are fantastic. There is hidden gem of an API that gives access to the current X++ call stack in the form of a container. This makes it relatively simple to include the call stack in the error messages shown in the Infolog. Just insert this line of X++ code in the add method in the info class just after the variable declaration section:

_txt += con2Str(xSession::xppCallStack()); 

Now run the scenario, and inspect the Infolog. It will include the call stack for each message, and will look something like this:



With this information it is much easier to browse through the many messages in the Infolog and find variations in the call stacks.

This post is provided AS-IS, and confers no rights or warranties.




==============
Источник: http://blogs.msdn.com/b/mfp/archive/...callstack.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.