When your metaDictionaryItemArray1.Length is "0" then the
and therefore it will throw the exception as you are getting now. Also, your loop is do..while() that will execute the statements inside it at least once even while condition fails.
Read about the array behavour for more info.
You r 100% right .. the point is that is Commerce code bit mine ;) I found the issue and reported here
Thanks for your investigation - much appreciated. I have filed a bug for Commerce team.
Tnx buddy ..
We added new custom properties to the PurchaseOrder. The new properties of type of "DictionaryMultiValue" and "DictionarySingleValue". Now in our code when we convert cart to order it works perfectly but when we try to load the purchase order it throw exception as below:
Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source File: C:\projects\S60\UTS\Episerver.UTS.Web\UTS\Features\CheckoutPage\Services\CheckoutService.cs Line: 140
After digging down I found the code of Mediachase.MetaDataPlus.MetaObject.CloneMetaFieldReferenceTypes as below:
Seems like below like causing the error:
as if the metaDictionaryItemArray1.Length is "0" then it throws an exception. Can anyone help with this? Appreciate help!