Specified argument was out of the range of valid values error

I have a SC solution that is running a static MOM product configuration. We are trying to run the OnPageLoad code via SC using the ExecutePageOnLoad method. It’s been a nightmare to get this method to run. I have gotten the workflow/conversion to match the trace 100%, but still I get the error:

Specified argument was out of the range of valid values. Parameter name: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index.

How can the index be out of range, when I have verified I am doing the exact same thing as what’s in the trace? I’m starting to think you can’t use this method in SC. Any input is greatly appreciated, I’m lost.

Also important to note: I made the onpageload events themselves static. There is no querying nor anything else; just trying to get SC to run it and set strings to “Page 2 ran”.

You are a brave soul trying to extrapolate the PC to another application.

1 Like

Is it possible that when run in the UI, the controls get their default values set before the OnPageLoad function occurs, but in SC, they are not set yet. A combo with nothing selected might be considered to be an index out of range.

edit

A quick test might be to have code in the OnPageLoad function that the sets the controls to known good values, before any are referenced. Might not be practical in your end goal, but would be helpful for debugging.

2 Likes

Very fascinating response. I do see there’s an “OnLoad” event for the entire configurator. There, we’re setting many controls, a lot of which are used in our OnPageLoad events. I think you’re on to something, unfortunately, there’s no method in SC that allows me to run this “OnLoad” (for the config) event. Perhaps this is simply a limitation, not being able to kick off a UI event correctly. I’m really starting to think we’re going to need to take a different direction entirely and get these values to populate elsewhere.

1 Like