Wednesday, 18 February 2015

Trace Parser command line paramters

If you want to automate trace file open/import, Trace Parser supports command line parameters.
Usage: Microsoft.Dynamics.AX.Tracing.TraceParser.exe [options]

/log=[filename] - Used to log messages t the specified file.

/register  - Register a new or existing database. Options:

    /server=[hostname] - Name of the SQL Server. Default to localhost.
    /database=[database] - Name of the SQL Database

/(open|import)=[filename] - Imports a Trace File. Options:

    /id=[id] - TraceId if the file is already imported.

/consoleonly  - Run in console only.
This posting is provided "AS IS" with no warranties. Use code at your own risk.

Monday, 9 February 2015

Phantom objects in USR layer after compile using AXBuild

Recently we performed a cleanup of USR layer and moved the objects (created wrongly in that layer) to CUS layer or removed them if they were not required as we are supposed to have nothing in USR layer. We then removed the USR model using AXUtil. This went well until we noticed that there are some objects in USR layer. These included some classes and forms. Recompiling was bringing these objects back even if we remove these.

Examining these objects, we found that none of these have any difference from the layer below. These phantom objects were created while the application was compiled using AXBuild. A client compile was not creating these phantom objects.

So we contacted MS and were advised to apply KB 3015739 which is a binary hotfix. This however did not fix our issue. One of my colleague later discovered that if we pass an additional un-documented parameter /layer=cus to AXBuild, these phantom objects are not created.

Not sure if this parameter was present before or it was introduced due to the KB that we applied but it fixed out issue.

We are on AX2012 R2 with CU7.

This posting is provided "AS IS" with no warranties. Use code at your own risk.

Wednesday, 4 February 2015

Report error in Dynamics AX

We had the following error while users were trying to print reports from AX.
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:queryBuilderArgs. The InnerException message was 'Element 'http://tempuri.org/:queryBuilderArgs' contains data from a type that maps to the name 'http://schemas.datacontract.org/2004/07/XppClasses:SrsReportProviderQueryBuilderArgs'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'SrsReportProviderQueryBuilderArgs' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.
The problem goes away if you point the SSRS to another AOS through the AX client configuration or by restarting the AOS.

This posting is provided "AS IS" with no warranties. Use code at your own risk.

Thursday, 29 January 2015

PowerShell script for starting AX Perfmon event trace remotely

In my previous post I talked about starting AX Perfmon trace remotely. Attached to this post is the PowerShell script that does the same. The stop step also copies the trace generated to a network folder. Instead of starting the script in PowerShell and specifying parameters, I have created a shortcut for each operation on an AOS server. So from a remote machine, trace can be generated and can be loaded from the network folder for analysis.

The script folder have following files
StartStopTrace.ps1: This is where the actual PoweShell code resides.

Parameters.txt: Parameters file to specify the data collector set name, destination folder to copy trace and the source path of trace as shown below 
AXTraceTemplate.xml: This is the template to create data collector set on new AOS servers. This already have the recommendations suggested in original MS blog.

AOS 1 Start Trace shortcut: Use to start trace on AOS 1. The value of "Target" property of the short cut contains
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File .\StartStopTrace.ps1  -Operation Start -Server AXPROD-AO1
AOS 1 Stop Trace shortcut: This is similar to start shortcut except the operation is stop.

More shortcuts can be created for additional AOS as required.

This posting is provided "AS IS" with no warranties. Use code at your own risk.

Tuesday, 27 January 2015

Start AX Perfmon event trace remotely

There are several ways to create traces in AX2012 for performance monitoring/optimization. One of these is by using Windows Performance Monitor. Details of how to do this can be found here.

As this trace is configured on the AOS, so to start the trace you'll have to log in to the AOS. Use the following command to do this remotely.

Start Trace
logman.exe Start "<DATA_COLLECTOR_SET_NAME>" -S <SERVER_NAME>
Stop Trace
logman.exe Stop "<DATA_COLLECTOR_SET_NAME>" -S <SERVER_NAME>
Double quotes around data collector set name are required only if the it have a space.

This posting is provided "AS IS" with no warranties. Use code at your own risk.