Showing posts with label AX2012. Show all posts
Showing posts with label AX2012. Show all posts

Sunday, June 05, 2016

Windows Installer error 1603 when installing a kernel hotfix and error 1325 'globalassemblycache' is not a valid short file name

Here's my case: a test VM provided by a system administrator, system partition C:\ and an extra partition D:\ for working files, backups, etc. Several Dynamics AX instances installed and running, AX kernel has been successfully updated a couple of times. Then a system administrator decided to add a virtual CD drive as D:\ and changed the extra partition drive letter to E:\ - rather disturbing but not a big deal, I thought.
After a while I need to apply a recent AX kernel hotfix - but Windows Installer fails with error 1603 while applying the AOS kernel patch. In the verbose log there's also another error during the CostFinalize action:
Error 1325. 'globalassemblycache' is not a valid short file name.
This error is logged after adding lots of properties that map to subfolders of E:\globalassemblycache\. According to the KB834484 error 1603 means Windows Installer can't access the product folder or something. That is a clue because one of the properties, DirGAC.Blah-Blah-Blah, is logged to be set to D:\globalassemblycache, and in my case D:\ is a virtual CD drive with no image mounted.
I had changed the CD drive letter and the AX kernel hotfix installed successfully. Then I reverted the CD drive letter back - just in case.
The point is: in case of Windows Installer error 1603 look carefully for suspicious paths in the verbose log.

Friday, January 16, 2015

X++ types Date and UtcDateTime are not implicitly converted to System.DateTime in .NET CIL, in AX 2012

Consider the following code sample:
System.Web.HttpCookie   cookie  = new System.Web.HttpCookie('test');
date                    dateVar = today() + 1;
cookie.set_Expires(dateVar);
It's just a .NET class object with a property of System.DateTime type initialized by a value of X++ date type. This code works perfectly in X++, but in .NET CIL it raises System.NotSupportedException with a message DateTimeConverter cannot convert from Microsoft.Dynamics.Ax.Xpp.AxShared.Date (or DateTimeConverter cannot convert from Microsoft.Dynamics.Ax.Xpp.AxShared.utcdatetime in case of X++ utcDateTime type).
According to MSDN article How to: Marshal Between X++ and CLR Primitive Types [AX 2012]
in Microsoft Dynamics AX, the X++ language does implicit conversion or marshaling between several X++ primitive types and their counterpart types managed by the common language runtime (CLR).
such as dateSystem.DateTime conversion. Well, in fact it does utcDateTimeSystem.DateTime conversion, too! But when X++ code runs in .NET CIL you have to explicitly convert values between date/utcDateTime types and System.DateTime. And actually you should do that anyway ‐ just in case your code happens to run in .NET CIL, otherwise you'll get System.NotSupportedException when you least expect it...

Saturday, September 27, 2014

X++ Operators Div and Mod Behave Differently in .NET CIL, in AX 2012

X++ operators div and mod in CIL can cast their operands differently and return result of different base types compared to X++ interpreter. Consider these examples:
Test operationX++ resultsCIL results
0 div 2Integer0Int640
intMax() div 2Integer1073741823Int641073741823
realMax() div 2Integer1073741823Int644999999999999999
int64Max() div 2Int644611686018427387903Int644611686018427387903
intMax() mod 2Integer1Integer1
realMax() mod 2Integer1Real1,00
int64Max() mod 2Int641Int641

Tested in AX 2012 R2 with kernel builds 6.2.1000.4051 (CU7) and 6.2.1000.8310.

Tuesday, June 10, 2014

AX 2012: don't party with deleted PurchLines

In previous version of Dynamics AX if you delete a PurchLine record - it's gone from the table; it means that for a given purchase order you've got only "active" actual PurchLine records in the database table. AX 2012 has introduced a lot of new and enhanced Procurement and sourcing features including Change management for purchase orders. From a developer's perspective it means that PurchLine records are no longer deleted - instead they are marked with IsDeleted flag and filtered out on regular forms (obviously except for Purchase order versions form). So in customizations it's now vital to mind that and to select or update only PurchLine records with IsDeleted == NoYes::No predicate in the where clause. PurchTable.queryPurchLine() can provide you with a query that takes this into account.

Friday, May 02, 2014

Best Practice checks for objects in the current layer only in AX 2012

It took a small customization to make Best Practice checks in AX 2009 to omit application objects that are not present in the current application layer, which really makes a difference in terms of compilation speed. In AX 2012 you have this feature out of the box! In the development environment navigate to Tools > Options > Development > Best Practices and change the Layer setting to "Skip nodes from lower layers".