try catch not operational loadrecipe

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
beauto
Posts: 5
Joined: Mon Feb 03, 2014 10:01 am

try catch not operational loadrecipe

Post by beauto »

hello,

when i use :
try
{
Globals.TYPE_0.LoadRecipe("TYPE0");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
the load recipe not run
but without try it's work fine !
but why ?

stuartm
Posts: 61
Joined: Thu Jun 06, 2013 9:21 am

Re: try catch not operational loadrecipe

Post by stuartm »

Works fine. You need to have a recipe named "hello" to work. Otherwise, it will do nothing. Actually, no exception will be thrown so having a try catch here is pointless.

void Button1_Click(System.Object sender, System.EventArgs e)
{
try
{
Globals.Recipe1.LoadRecipe("Hello");
}
catch{
MessageBox.Show("Hello, I'm an Error!");
}
}

andrea
Posts: 72
Joined: Tue Dec 11, 2012 5:44 am

Re: try catch not operational loadrecipe

Post by andrea »

I found that trying to load some recipe, that fails, for example if it has a name containing single quote ('), the exception is not caught so the user doesnt' know the problem but the recipe is not correctly loaded.

My questions:

- how to catch and manage exception in case that internal system function Globals.Recipe1.LoadRecipe(Name) fails ?? Is that possible?

- what happens in the system when this function fails? What data are loaded? Random data?

- is there a list of known situation that cause a failing of LoadRecipe.
I found that with some special character in the name, for example single quote (') but for sure there are others situations

We are having issues with a customer where strange data (not corrected) are loaded and are not able to investigate and solve that.

Thank you

Post Reply