?Corrected from:
PLC Designer V3.14
Response of the new version:
The LoadFromAndWriteRecipe method can be used to read recipes from recipe files and write the values into the corresponding PLC project variables. No exception occurs.
What happens?
PLC processing stops with an exception. The following error message is entered into the logbook:
*EXCEPTION* [AccessViolation] occurred: App=[Application], Task=[Taskname]
When does this behaviour occur?
The behaviour occurs if the LoadFromAndWriteRecipe method of the RecipeManCommands function block from the RecipeManagement library is used.
The LoadFromAndWriteRecipe method is used to read a recipe from a recipe file and write the values into the corresponding PLC project variables.
Which products are affected?
PLC Designer from V3.12
Short-term measures:
To ensure that the exception does not occur, call the GetRecipeCount method before calling the LoadFromAndWriteRecipe method, e.g. as follows:
dwRetValueOfMethod := RecipeManCommands.GetRecipeCount(
RecipeDefinitionName:= sRecipeDefinitionName);
dwRetValueOfMethod := RecipeManCommands.LoadFromAndWriteRecipe(
RecipeDefinitionName := sRecipeDefinitionName,
RecipeName := sRecipeName,
FileName:=sFileName);
The GetRecipeCount method outputs the recipe count of the corresponding recipe definition.
Evaluation/recommendations:
If the Recipe Manager is used in a PLC project, executing the LoadFromAndWriteRecipe method may lead to an exception as a result of which PLC processing may be stopped. A remedy is described under 'Short-term measures'.