Skip to main content

Introduction to Compile errors in Frends

Reasons for compile errors

R
Written by Riku Virtanen
Updated over a year ago

Compile errors in Frends

When you save a Process, the Process is compiled into C# source code. If there are errors that prevent the compilation of a Process, you are not able to save the Process. Although you are able to create a draft of the Process, which will only save to the Process graph without compiling the Process source code. Errors that prevent saving a Process are called compile errors. Compile errors are quite common when you are using code Elements in Processes. They are also quite cryptic if you haven't seen them before since the error messages are not pointing to the exact code Element containing the problem, since compile errors occur in the Process source code. In this module we will take a look at some common compile errors that might occur when you are using code Elements.

Missing semicolon in C# Statement

If you are using C# Expressions, you don't have to add semicolons (;) at the end of a line since it's just one line of C# code. When you are using C# Statement Element then you need to add a semicolon at the end of each line since you can run multiple lines of code using the Element. If you forget to add a semicolon you will get the following error

If you see this error, you should check your C# Statement Elements to ensure that all lines end in a semicolon.

Type mismatch

Sometimes you may pass a value that is not the correct type. For example, passing a string to a variable which is typed as int. If you try to pass the wrong type of value to a variable, you will get the following error:

If you see this error, then you should check your code Elements for any incorrect types.

Typos in code

There can be multiple different errors that might occur if you type something wrong. Let's take a look at some of the example errors. Below is an example in which you type the variable name wrong:

This error will occur if you type a variable type wrong:

This error will occur if you are trying to call a method, but you type the method name wrong. For example, if you are trying to call the String.Replace() method, but you make a mistake with the method name, the following error will occur:

Wrong target selected for Process

Sometimes there are differences in classes depending on the target selected for the Process. For example, if we take a look at the String.Replace() method. Looking at .NET Standard 2.0 documentation we can see that there are two overloads for the method. If we take a look at .NET6 documentation, we can see that there are four overloads. If a Process is targeting .NET Standard 2.0 and you try to use one of the overloads that is not available in .NET Standard 2.0, you will get the following error:

The error might also indicate that there is an issue in the provided parameters, but if the parameters should be correct then you should also check which target you have selected for the Process and if the method is implemented for the selected target.

Did this answer your question?