Typical Compilation Errors

When compiling custom code either by clicking Validate Code or indirectly via simulation/optimization start some compilation errors might appear. Next typical errors are listed with its solutions,

Extended Variables names typos

An extended variable name is used and there is a typo in its name. Extended variables names cannot be modified. They are declared in the region ExtendedVariable. Those are used along the custom code in different ways, make sure the name is exactly the same as the one in the ExtendedVariable region.

Example

From custom code, ExtendedVariables region,

#region ExtendedVariables
    // State variables
    private ExtendedVariable CDWgL;
    ...
#endregion

we use in line 55 CDWgL extended variable,

this.CDWg.DisplayName = "CDW (g/L)";

throwing exception,

"Error (CS1061). Line: 55, Column: 7. 'Novasign.IdentificationToolbox.Simulation.DataClass.Simulation_VariablesExtended' does not contain a definition for 'CDWg' and no extension method 'CDWg' accepting a first argument of type 'Novasign.IdentificationToolbox.Simulation.DataClass.Simulation_VariablesExtended' could be found (are you missing a using directive or an assembly reference?)"

because CDWgL is typed as CDWg, missing the last L. The compiler is trying to find a non declared variable named CDWg resulting in exception does not contain a definition for 'CDWg'.

Unset variables

When custom code gets generated for the first time, or after clicking the Reset Code or Update mandatory variables, code sections will be reset/replaced possibly containing sections that can not be automatically determined by the toolbox (e.g., SimMin value). In that case, a place holder TOBESET is provided expecting user to replace it by the proper value.

Example

Following exception is shown,

"Error (CS0103). Line: 27, Column: 22. The name 'TOBESET' does not exist in the current context"

when in line 27, there is following code,

this.XAxis.SimMin = TOBESET; // Start value

expecting user to provide a valid value for that field,

this.XAxis.SimMin = 1.2; // Start value