web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The given key was not present in the dictionary when calling 'GenerateDocument'

(0) ShareShare
ReportReport
Posted on by 278

Hi All,

I am getting below error while calling 

Microsoft.Dynamics.AX.Framework.DocumentRender.DocumentGeneratorHelper::GenerateDocument. It was running fine and out of no where it got stuck to this error. Same code is running fine in Test environment. Usually this error occurs when running CIL.

Can anyone help me on this? I have tried many things,

  • Running FULL CIL
  • Deleting XPPIL folder, restarting AOS and running Full  CIL and DB Synchronization. 
  • Debugging didn't help much. 

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at System.Collections.ObjectModel.KeyedCollection`2.get_Item(TKey key)
at Microsoft.Dynamics.AX.Framework.Services.Client.QueryFieldMetadataProxyExtensions.AsQueryFieldMetadata(QueryFieldMetadata queryFieldProxy, TableMetadata tableMetadata)
at Microsoft.Dynamics.AX.Framework.Services.Client.QueryMetadataProxyExtensions.QueryDataSourceProxyTransformer(QueryMetadata query, IQueryDataSourceMetadataProxy dataSource, TypeExpansionMode typeExpansionMode)
at Microsoft.Dynamics.AX.Framework.Services.Client.QueryMetadataProxyExtensions.QueryDataSourceProxyTransformer(QueryMetadata query, IQueryDataSourceMetadataProxy dataSource, TypeExpansionMode typeExpansionMode)
at Microsoft.Dynamics.AX.Framework.Services.Client.QueryMetadataProxyExtensions.AsQueryMetadata(IQueryMetadataProxy queryMetadataProxy, TypeExpansionMode typeExpansionMode)
at Microsoft.Dynamics.AX.Framework.Services.Client.QueryMetadata.Deserialize(Object serializedQueryMetadata, QueryMetadata& serviceContract)
at Microsoft.Dynamics.AX.Framework.OfficeAddin.DynamicsAX.DynamicsPersistenceProvider.Deserialize(DataSourceManager dataSourceManager, String queryDefinitionXml, Boolean validateSchema)
at Microsoft.Dynamics.AX.Framework.OfficeAddin.DynamicsAX.DynamicsPersistenceProvider.Open(DataSourceManager dataSourceManager, DataSourceXmlPart xmlPart, Boolean shouldCache)
at Microsoft.Dynamics.AX.Framework.DocumentRender.DocumentGenerator.GetDataSet(DocumentDataSource documentDataSource, DocumentXmlPart documentXmlPart)
at Microsoft.Dynamics.AX.Framework.DocumentRender.DocumentGenerator.Create()
at Microsoft.Dynamics.AX.Framework.DocumentRender.DocumentGeneratorHelper.GenerateOutputDocument(Uri outPath, AuthenticationType authenticationType, MemoryStream inputStream)
at Microsoft.Dynamics.AX.Framework.DocumentRender.DocumentGeneratorHelper.GenerateDocument(Uri inputPath, AuthenticationType inputAuthType, Uri outPath, AuthenticationType outAuthType, String tableName, String fieldName, String fieldValue, String company, String partitionKey, String aosHostAndWsdlPort)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    Hi,

    I had the same error.

    after your full CIL, did you have any errors?

    for all the error you have, go and compile manually the objects with errors.

    After the compile, run again the Full CIL Compile.

    Thanks!

  • Vishal Jevtani Profile Picture
    278 on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    I did the full compile and Full CIL. no errors were there in Log file, only few warnings. This functionality was working before, now we cannot figure out what wentwrong.

  • Community Member Profile Picture
    on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    Why don't you try the X++ Compile?

  • Vishal Jevtani Profile Picture
    278 on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    X++ Compile? You mean from AOT, not the parallel compile from CMD?

  • Community Member Profile Picture
    on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    Yes, Do the Compile using CMD, this will be faster.

  • Vishal Jevtani Profile Picture
    278 on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    The error is still there. Full CIL and compile had no errors

  • Verified answer
    Vishal Jevtani Profile Picture
    278 on at
    RE: The given key was not present in the dictionary when calling 'GenerateDocument'

    We managed to resolve it. The problem was with the document template, the query was modified in AOT and we had to re-map the fields in the document template.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans