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.

Tuesday, 13 January 2015

Bug in DynamicsPerf views

If you have used DynamicsPerf, you may have come across views to analyse Dynamics AX database for performance issues. Two of these views are
  • MISSING_INDEXES_CURR_VW 
  • QUERY_STATS_CURR_VW. 
As the name implies, these views gives insight into the missing indexes or query stat for the last run of the capture stat job (hence the word CURR in the name). There are similar views without the CURR word which shows data for all runs of capture stat job.

In the latest version (1.2) there is a bug in the views resulting in these showing all data instead of the last run of capture stat job. To fix the bug change the views and add the highlighted lines
           INNER JOIN STATS_COLLECTION_SUMMARY S2 WITH (NOLOCK)  
         ON QS2.STATS_TIME = S2.STATS_TIME  
          AND QS2.DATABASE_NAME = S2.DATABASE_NAME AND S2.RUN_NAME NOT LIKE 'BASE%'  
                      AND QS2.STATS_TIME = (SELECT MAX(STATS_TIME)  
                  FROM  STATS_COLLECTION_SUMMARY)  
     GROUP BY QS2.DATABASE_NAME,  

Note: Similar changes may be required in other views as I haven't had a chance to use all of these.

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

Friday, 12 December 2014

Debugger not installed

I was writing some automation scripts and as part of the automation I was supposed to specify AX client log folder path in the cleanup task but by mistake I gave client bin folder path. This resulted in everything being wiped from that folder and clicking on the AX client shortcut gave an error. I was able to recover from this by running the repair on the AX client in "Control Panel\Program and Features".

All was fine until I hit a breakpoint and a message popped up saying "debugger is not installed. Please install the debugger". But I had the debugger installed. The repair on the client fixed the client related files but not the debugger. So I ran the installer again and there the debugger option was already ticked so the installer did not let me proceed.

The solution was simple. Just copy the AXdebug.exe from the following location in the installer folder to the client bin folder and everything this was fine (for 64-bit machine).

..\Msi\Components64\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin

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