One of the great features of Dynamics AX is the rich integration with other applications or services. The Dynamics AX client is for example exchanging data with Microsoft Office applications like Microsoft Office Excel or Microsoft Office Outlook.

Some of these interactions are performed using COM. When the Dynamics AX Client is using COM for the data exchange in certain situation it can happen you are getting confronted with one of the following error message:

  • Error executing code: The method has been called with an invalid number of parameters
  • The number of arguments provided is different from the number of arguments accepted by the method

Certain situations means, that you are not always getting this error message but only sometimes and the error is not reproducible. The chance of getting this error message is higher when you continue to work in other applications while the Dynamics AX client is performing the COM operation.

One reason for running into this issue can be if the Windows Operating System is replacing the Dynamics AX application window by a ghost window.

When Dynamics AX starts a lengthy COM operation, it is not responding to messages sent by the Windows Operating System in time. So Windows supposes Dynamics AX has stopped responding. When this happens the Dynamics AX application window is replaced by a ghost window until Dynamics AX resumes. Window ghosting is a nice feature that allows the user to minimize, move or close the main window even if the application is not responding. You can easily identify a ghost window as it shows (Not responding) in the window title.

Unfortunately the replacement of the Dynamics AX application window by the ghost window can interfere the COM operation and result in the above error message.

Therefore it can be helpful to turn window ghosting for the Dynamics AX Client off:

  1. Locate the Dynamics AX shortcut in the Windows Start Menu
  2. Click with the right mouse button on the shortcut and select Properties
  3. Go to the Compatibility tab
  4. Enable the checkbox Run this program in Compatibility mode for and select Windows XP (Service Pack 2)

Please note:

  • We have seen this issue most on Windows Vista and Windows Server 2008 but this issue is not limited to those two
  • Window ghosting is not the only cause of this issue, so you might continue to see the error message even if window ghosting was turned off

More information about window ghosting:

--author: Alexander Lachner
--editor: Alexander Lachner
--date: 18/06/2009
--updated: 03/08/2010