Understanding Decisions Code Compilation
  • 14 Aug 2023
  • 2 Minutes to read
  • Dark
    Light

Understanding Decisions Code Compilation

  • Dark
    Light

Article Summary

This article provides a look into how Decisions compiles code and methods of troubleshooting errors that may occur.

Overview 

It's important to note that unlike some other 'low-code' applications, Decisions does not require the use of coding, nor does it generate code to be deployed elsewhere for its Flow or Rules logic. Code compilation only happens to support custom data structures.

When a data structure is created or modified within the web application instructions for that change need to pass to the database where the structure resides. The web application writes this information into .cs files and sends them to the Code Compiler, an executable named SHMCBC.exe within the Decisions installation folder. The executable takes the .cs files and bundles them together into .dll files called Code Buckets. These .dll files are stored in the CodeBucketsAssemblies folder within the installation folder. 

The .NET framework Decisions is built upon is able to read the Code Buckets and dynamically show the new data structure changes to the user without having to restart the system.


Code Buckets

Code Bucket files are generated sequentially based on data structure changes. The newest file is GeneratedCodeBuckets.1.dll and older files have an increased integer. 


When a Flow pulls from a data structure it interacts with a layer of code known as the Type Utility. This code determines which Code Bucket .dll file to use. It defaults to the most recent file. However, if the Flow references a data structure that is not in the most recent Code Bucket, Type Utility can read the next most recent file and so on until it finds the missing data structure to allow the Flow to continue running smoothly.



Triggering Code Compiler

The Code Compiler triggers every time a data structure is changed. A user can also trigger it to run by right-clicking on a Designer Folder then selecting Other > Recompile Data Structures or  Other > Recompile Code Buckets. Despite being on a specific Designer Folder, Recompile Data Structures will do so for all the data structures in the environment.

Recompiles also occur when a project is imported through the Import/Export option. 


Troubleshooting

If there are issues with data types not appearing as intended these can usually be resolved by forcing the Code Compiler to run or by deleting the CodeBuckets.dll files. All CodeBuckets.dll files can safely be deleted at any time. If Decisions finds no files it will regenerate the most recent one.

There are some problems that must be solved in other ways.

Clusters

Clusters do not compile in sync with each other. They can end up with different Code Buckets and therefore different data structures. Clustering is not supported in a development environment for this reason.

Data Type Naming

Data types using incorrect names can cause the Code Compiler to fail. Changes will have to be made to the data structure to resolve the issue.

Common Data Type Naming Problems
Any column called "Name".
Data type with same name as the folder it resides in.
Any reserved word in .NET core such as "System".
Data types with initial underscores such as "_FirstName" or "_Rate". 
Duplicative data type names

Anti-virus Software

Anti-virus software can cause the code compiler to fail.

"Using it....but need to figure out why" Errors

Errors that include a data structure name and the message "Using it....but need to figure out why." indicate that a data structure did not compile correctly. See an example below:

  1. To resolve go to System > Administration > System Tools > Event Viewer.
  2. Filter report by Invalid.
  3. Select Include in Next Compile under Retry in the right click context menu on any types that show up as Invalid.
  4. Right click on a designer folder and select Other > Recompile Data Structures.




Was this article helpful?

What's Next