.NET Framework or .NET Core ALC.exe? Which one to choose.
With Dynamics 365 Business Central, it is quite common to compile using the native compiler ALC.exe through PowerShell scripts or command line. This is mainly used within CI/CD implemented as development lifecycle.
Sometimes we have seen, typically with very large extensions, that VS Code compilation runs successfully while using ALC.exe it ends into an unhandled OutOfMemory exception, like the one below or similar (NOTE: this is just an example)
Compilation ended at '16:05:11.460'.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
at Microsoft.Dynamics.Nav.CodeAnalysis.RelativeFileSystem.ReadBytes(String path) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Compilation\RelativeFileSystem.cs:line 23
at Microsoft.Dynamics.Nav.CodeAnalysis.Translation.LanguageFileExtracting.ExtractXliff12(IFileSystem fileSystem, String filePath, LanguagesMetadata languagesMetadata, DiagnosticBag diagnostics, HashSet`1 lang
uagesAdded, List`1 languagesAndFiles) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Translation\MetadataExtraction\LanguageFileExtracting.cs:line 91
Not that many know that there are 2 very different ALC.exe. These 2 good brothers, are both released within marketplace VSIX package:
.NET Framework ALC.exe
- Currently based on .NET 4.8
- Typically stored in \bin folder (e.g. C:\Users\dtacconi\.vscode\extensions\ms-dynamics-smb.al-8.4.586670\bin )
- WORSE in handling resources (memory and processor)
.NET Core ALC.exe
- Currently based on .NET 5
- Typically stored in bin\win32 folder (e.g. C:\Users\dtacconi\.vscode\extensions\ms-dynamics-smb.al-8.4.586670\bin\win32 )
- BETTER in handling resources (memory and processor)
To summarize, then, if you have CI/CD implemented or simply you are in need to use ALC.exe, Microsoft strongly and warmly recommends using the .NET core based ALC.exe from win32 folder. Also, worth mentioning to use the one from the latest and greatest marketplace VSIX, where possible.
Comments
-
Thank you very, very much!!! I've been trying to compile using the framework version and despite 128GB of RAM I just kept getting the Out of Memory Error. I suspect it's running as a 32bit process?! I can't thank you enough :)

Like
Report
*This post is locked for comments