Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Problem with cross reference update in Dynamics AX 2012

Posted on by 130

Hello everyone,

Can anyone help me solve a problem that has arisen during the update of the cross-reference in Dynamics AX 2012. After running the script

static void CrossRefUpdateBatch(Args _args)
{
    ;

    xRefUpdate::truncateXrefTables();
    xRefUpdateIL::updateAllXref(true, false, true);
    info("Done, cross reference update batch job created.");
}
, the following errors have occurred:

  • Unable to generate cross reference information for assembly: Microsoft.Dynamics.Ax.Tms.dll
  • Unable to generate cross reference information for assembly: Microsoft.Dynamics.AX.Framework.Tools.CodeUpgradeTool.Parser.dll
  • Unable to generate cross reference information for assembly: Microsoft.ApplicationInsights.dll
  • Unable to generate cross reference information for assembly: Microsoft.Dynamics365.XppSupportLayer.dll

The error occurs on line 107 in the script (\Classes\xRefAssemblyReferences\updateXrefAssembly)

/// 
///    Identifies references to AOT elements from an assembly that is registered under AOT References.
/// 
/// 
///    A tree node for the assembly to inspect.
/// 
/// 
///    The name of the assembly to do cross reference over.
/// 
/// 
///    The path where the assembly is located.
/// 
/// 
///    Boolean whether the assembly can stay loaded after cross reference is ran over.
///    Example: VS Projects need the assembly to be unloaded to be updatable if code changes are made.
/// 
public static void updateXrefAssembly(TreeNode _treeNode, str _assemblyName, str _assemblyPath, boolean _loaded = true)
{
    Microsoft.Dynamics.AX.Framework.CrossReference.ReflectorHost reflectorHost;
    Microsoft.Dynamics.AX.Framework.CrossReference.Reflector reflector;
    Microsoft.Dynamics.AX.Framework.CrossReference.Reference reference;
    str referedElementName;
    int xrefReferedElementType;
    int operationType;
    int line;
    int column;
    int parentType;
    int parentId;
    str parentName;
    str source;
    boolean moreReferences;
    int numberOfReferencesFound;

    try
    {
        //If the assembly is not loaded - Create AppDomain to be able to unload assembly after cross reference performed.
        if (!_loaded)
        {
            //BP Deviation Documented
            reflectorHost = new Microsoft.Dynamics.AX.Framework.CrossReference.ReflectorHost();

            //Create the reflector object through host passing in the client bin path
            reflector = reflectorHost.startDomain();
        }
        else
        {
            //BP Deviation Documented
            reflector = new Microsoft.Dynamics.AX.Framework.CrossReference.Reflector();
        }

        // Identify the list of references
        reflector.findReferences(_assemblyPath   _assemblyName);
        numberOfReferencesFound = reflector.numberOfReferences();

        // Store the references
        if(numberOfReferencesFound > 0)
        {
            do
            {
                reference = reflector.nextReference();
                reference.getValues(byref referedElementName,
                                    byref xrefReferedElementType,
                                    byref operationType,
                                    byref line,
                                    byref column,
                                    byref parentType,
                                    byref parentName,
                                    byref source);

                switch(parentType)
                {
                    case UtilElementType::Table:
                        parentId = tablename2id(parentName);
                        break;
                    case UtilElementType::Class:
                        parentId = classname2id(parentName);
                        break;
                    case UtilElementType::Enum:
                        parentId = enumname2id(parentName);
                        break;
                }

                _treeNode.AOTaddXref(referedElementName,
                                     xrefReferedElementType,
                                     line,
                                     column,
                                     operationType,
                                     parentId);

                moreReferences = reflector.more();
            }
            while(moreReferences);
            _treeNode.AOTendXref();
        }
        // Unload AppDomain. This will unlock any assemblys loaded during xRef.
        if(!_loaded)
        {
            reflectorHost.unloadDomain();
        }
    }
    catch
    {
        if(!_loaded)
        {
            reflectorHost.unloadDomain();
        }
        error(strfmt("@SYS320347",_assemblyName));
    }
}

Can anyone help me get rid of these errors and explain why they are occurring?

Thank you in advance for your help!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans