Chapter 9. Tracing and Debugging

Most Microsoft Dynamics AX developers are very familiar with debugging using the Microsoft Dynamics AX debugger. However, because services are compiled to CIL, you'll spend a lot more time with the Visual Studio debugger. Some find this off-putting, but the debugging process is actually very straightforward.

Developers may be used to debugging, but tracing is another story. Probably one of the most underused features of Microsoft Dynamics AX 2012 is the Tracing cockpit, which is first and foremost a tool for measuring performance. This is something you should always do when developing with Microsoft Dynamics AX, including when using its services. You can also use it to extract tracing information about X++ code from an environment where debugging is not an option and then study it using the Microsoft Dynamics AX Trace parser.

In a live environment, it is better to use WCF tracing; it has less performance overhead and provides you with a wealth of information that helps you when troubleshooting problems.

In this chapter, we will introduce these tools and look at when and how they can be used.

The following topics will be covered in this chapter:

  • Using the Microsoft Dynamics AX debugger: We start by using the debugger that Microsoft Dynamics AX developers are most familiar with.
  • Using the Visual Studio debugger: As code running in services in Microsoft Dynamics AX is compiled into CIL, a lot of debugging will be done in Visual Studio. We'll see how to set this up and use the Visual Studio debugger.
  • Using the Tracing cockpit: The Tracing cockpit is a tool that allows you to collect tracing information about X++ code. We will see how it is used and how we can interpret the output.
  • Using the integration port logging mode: Integration ports provide a way to log messages that are sent from and to Microsoft Dynamics AX 2012. This can be especially helpful for troubleshooting services when you have pipeline components that are transforming messages. We will look at how to set this up.
  • Using WCF message logging and tracing: Sometimes debugging is not an option, and that's when message logging and tracing comes very handy. We will set up WCF message logging and tracing and look at how we can interpret the output.

Installing development tools

This chapter uses a number of development tools that can be installed using the Microsoft Dynamics AX setup. These tools are listed in the setup wizard under the Development tools node and consist of the following:

  • Debugger: This is the Microsoft Dynamics AX 2012 debugger used to debug X++ code running on the client and server.
  • Visual Studio tools: As discussed in Chapter 6, Web Services, installing the Visual Studio tools will add a number of extensions to Visual Studio. This includes the Application Explorer, which we will use to set breakpoints to debug code running in CIL.
  • Trace Parser: This installs the Microsoft Dynamics AX 2012 Trace Parser, which is used to analyze trace files generated by the Tracing cockpit.

    Note

    If you are having trouble installing or configuring these components, refer to the Microsoft Dynamics AX 2012 Installation Guide at http://www.microsoft.com/en-us/download/details.aspx?id=12687.

From here on, we assume that you have successfully installed these components and configured both client and server components to allow the debugging of code running on the client, server, and CIL.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.191