I don't have expectations of any direct answers, but I'm really hoping that someone can help give me some insight or direction of where to go next. We're using Dynamics AX 2012 R2 CU7.
Part 1: The mystery of the out of order class import
As part of our automated build process, we use the combinexpo.exe utility that comes with Dynamics AX 2012 R2. When it does the work of combining all of our XPO's, it seems to do something a bit funky with a base class and it's derived classes. It puts the derived classes first and then puts the base class after during the import. Because of this, we end up with some errors during the import as the classes are being imported in the wrong order ( in my opinion ).
Here's what I see in the import log.
<Info>Imported AOT element: \Classes\PdsFormCtrl_InventTransferUpdateRemain</Info>
<Info>Imported AOT element: \Classes\PdsFormCtrl_PurchUpdateRemain</Info>
<Info>Imported AOT element: \Classes\PdsFormCtrl_SalesUpdateRemain</Info>
<Info>Imported AOT element: \Classes\PdsFormCtrl_UpdateRemain</Info>
I'm thinking that the PdsFormCtrl_UpdateRemain should be imported first.
Has anyone else seen this?
As well, I see this exception in the Event Log, but this is a brand new file that the CombineXPOs creates.
CombineXPOs.exe : Error [c:\somelocation\combinedmodel.xpo] System.IO.IOException: The process cannot access the file 'c:\somelocation\combinedmodel.XPO' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Microsoft.Dynamics.AX.BuildTools.CombineXPOs.XpoReader..ctor(String file)
at Microsoft.Dynamics.AX.BuildTools.CombineXPOs.MainClass.addFileNoCatch(StreamWriter destinationFile, String filename, Boolean allowDuplicate)
at Microsoft.Dynamics.AX.BuildTools.CombineXPOs.MainClass.addFile(StreamWriter destinationFile, String filename, Boolean allowDuplicate)
Part 2: The mystery of why the hell does it take so long to import the combined XPO?
Further along our automated build process, we do the work to import the combined XPO. It's imported via an XML startup file that used the XpoImport command and sets up logging.
<?xml version="1.0" encoding="utf-8"?>
<AxaptaAutoRun version="4.0" logFile="importmodel.log" exitWhenDone="true">
<XpoImport file="model.xpo" />
</AxaptaAutoRun>
The arguments to do the import look like this:
$arguments = '-aol={0} -aolcode="{1}" -lazyclassloading -lazytableloading -nocompileonimport -internal=noModalBoxes -model=@{2} -startupcmd=autorun_{3}' -f $layer, $layerCode, $model, $importXml
So, this process has typically been about 30 minutes, but after some minor code changes that were checked into TFS, this jumped to ~63 minutes. The changes were to existing items that were in TFS and were quite minor. I've scoured through the import log ( that's where I found the errors in part 1 ), but I cannot find any indicator of why this is happening. Nothing else changed on the server as far as I know and the build process has been zinging along without any changes for months and months. I've also been through the event log and the import log. I haven't seen anything that's an indicator. I've also manually imported the combined XPO and haven't seen anything different than the automated import.
All of the other tasks excluding the AXBuild.exe process take approximately the same time to complete ( DB Sync, CIL, etc ).
Is there anywhere else I can look to see errors? Could there be caching, settings, etc that's in Dynamics for the build user? Any ideas of where I can look, what I can flush, or what I can beat up would be appreciated.
I've been assured by our infrastructure group that nothing on our servers have changed that would cause this ( I know, I know, never trust server guys ).