Configurator OnFieldChanged Expression Causes Stack Overflow Error

I have an onFieldchanged expression in my configurator where I do a PClookup and then convert the result of that to a decimal. For some reason, converting it to a decimal and setting a field to it crashes Epicor.

I tried to capture it in a try/catch statement but it escaped that so I looked up the exception code windows was giving me, c00000fd and it was a stack overflow error. I know that could result from accidental endless recursion but if that’s the case it seems to be on Epicor’s side and not mine.

Here is the code that breaks it, does anyone know how I would go about fixing this or what could be causing it?

if(Inputs.HoistMFG.Value == "R&M")
{
    //Epicor is fine with this line
	Inputs.HoistReeving.Value = PCLookUp.DataLookup("RM_MonoRail_Hoists", "Reeving", Inputs.HoistModel.Value);

    //Epicor crashes after this line
	Inputs.HoistListPrice.Value = System.Convert.ToDecimal(PCLookUp.DataLookup("RM_MonoRail_Hoists", "Price", Inputs.HoistModel.Value));
}

This is what Windows was telling me about the error, not sure if useful or not beyond the exception code

Hello Brian,

What if you assigned the PCLookup value for the Price to an intermediate field? Cast to string first, check it out, and then convert it to a decimal.

Just a thought,

Mark W.

I tried that with some messageboxes to try to identify what was causing the crash.

string str = PCLookUp.DataLookup(“RM_MonoRail_Hoists”, “Price”, Inputs.HoistModelCombo.Value);
MessageBox.Show(“1st”);
decimal d = Convert.ToDecimal(str);
MessageBox.Show(“2nd”);
Inputs.HoistListPrice.Value = d;
MessageBox.Show(“3rd”);

Still crashes, but after it shows the 3rd messagebox

Maybe it has nothing to do with the code in the event but on the calling form. Did we delete an input and re-add it? Is there code in another event that might be firing causing the error?

Mark W.

It could be that actually. I had this error several months ago and it was fixed by deleting and remaking the control.
I tried that with this and it didn’t work so you might be right that it is a different control that I’ll need to remake as well.

Is there any way to tell if an input’s calling form is corrupt in some way? I have dozens of inputs on this page and even though I moved all the calculations into one input, it’s still a bit tedious to go through and re-add all of them.

It isn’t pretty, but you could export the configurator and search through the XML text…

Mark W.

What would I be looking for in the XML? that might be easier for me.

When you export it, it will be apparent where there’s code. See the expression element below:

101 cmbCellType Automated_Inspection Changed 1 if (Inputs.cmbCellType.Value=="MSS") { Inputs.radIOConfig.Value="Standard"; Inputs.cmbRobotType.Value=null; Inputs.grpRobotComms.Value=null; Inputs.numQtyRobot.Value=0; Inputs.chkVFDisasterRecov.Value=false; } …

Mark W.

Woops. Discourse removed the tags…

< PcInputsExpr>
< Company>101< /Company>
< PartNum />
< RevisionNum />
< InputName>cmbCellType< /InputName>
< ConfigID>Automated_Inspection< /ConfigID>
< TypeCode>Changed< /TypeCode>
< SeqNum>1< /SeqNum>
< Expression>if (Inputs.cmbCellType.Value==“MSS”)
{
Inputs.radIOConfig.Value=“Standard”;
Inputs.cmbRobotType.Value=null;
Inputs.grpRobotComms.Value=null;
Inputs.numQtyRobot.Value=0;
Inputs.chkVFDisasterRecov.Value=false;
}< /Expression>

I exported it and don’t see anything wrong with my CodeTrigger readonlyexpression.
Nothing stands out to me as wrong but if I change Inputs.HoistOption1.Value it crashes Epicor still. (this is the only code left in at the moment that converts stuff to a decimal and then assigns the value)
Maybe there’s something I’m not seeing

Nothing jumping out at me either. Just grasping at straws but maybe it doesn’t like the ReadOnly event?

Mr. Shoemaker of Epicor puts all his event code into a server UD method. If you do that, you can try moving it to other events besides the ReadOnly. Again, just a thought.

Mark W.

I ended up just deleting and remaking all of the decimal inputs and it’s back to working. Just praying it doesn’t break again when we move it from our pilot to live database.