It was a bright Monday morning and I was sipping on my tea at the desk trying - preparing a “to do list” for the week that started. A developer from the team working on modifying Enterprise Portal Web Controls in AX 2012 R3 CU8 for one of our customers in Netherlands; approached me. He wanted to share some vital information to me, so that I can in turn write and publish the same for the benefit of everyone. He wanted everyone to know that what can be one of the errors while doing Enterprise Portal Development.

 He said, the team was working in changing the structure of an original table before working on the control. After making necessary changes, they were planning to go into the Enterprise portal and attempt to view a page, but were getting an unexpected error message:

Exception of Type ‘Microsoft.Dynamics.AX.Framework.Services.Metadata.Exceptions.MetadataItemException`

1[Microsoft.Dynamics.AX.Framework.Services.Metadata.Contracts.QueryDataSourceMetadata]’ was thrown.

Microsoft.Dynamics.AX.Framework.Services.Client.InteractionServiceException at Microsoft.Dynamics.AX.Framework.Services.Client.ServiceClientHelper.

InvokeChannelOperation[TResult,TChannel](IServiceClient`1 client, Func`2 operationInvoker, Func`2 exceptionWrapper)

at Microsoft.Dynamics.AX.Framework.Services.Client.InteractionService.

InteractionServiceClient.Initialize(IInteractionArguments interactionArguments, IInteractionObjectIdentifier interactionObjectIdentifier)

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxListPageContentArea.InitializeListPageContent Area()

at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxListPageContentArea.OnLoad(EventArgs e)

Exception of Type

‘Microsoft.Dynamics.AX.Framework.Services.Metadata.Exceptions.MetadataItemException`

1[Microsoft.Dynamics.AX.Framework.Services.Metadata.Contracts.QueryDataSourceMetadata]’ was thrown. System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception Rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at Microsoft.Dynamics.AX.Framework.Services.InteractionService.IInteractionService.Initialize (InteractionArguments interactionArguments, InteractionObjectIdentifier interactionObjectIdentifier)

at Microsoft.Dynamics.AX.Framework.Services.Client.ServiceClientHelper.

InvokeChannelOperation[TResult,TChannel](IServiceClient`1 client, Func`2 operationInvoker, Func`2 exceptionWrapper)

Developers did some research and then finally were able to find out the control that was triggering the error, which then they loaded up in the Visual Studio. Visual Studio gave a prompt that there was an undefined field in the Dataset used on the control. Then they looked at the AOT, to find the field listed in the dataset, which confused them further.

Doing a deep stick, they finally reached a conclusion that caching was the reason for this issue. So they cleared the Dictionary cache from within the Development environment (Tools > Cashes > Refresh Dictionary) and redeployed the Enterprise Portal again, and to everyone’s happiness the error was no more thrown at the development team.

He was of the opinion that restarting the AOS would have given the same output, however; he found it to be an overkill of the AOS when the cache clear was equipped to resolve the problem.