Cannot not open purchase order in Commerce Manager

Vote:
 

Hi!

All of a sudden there are purchase orders that I cannot open in Commerce Manager. I get the following exception on the following url:

https://xxx:443/Apps/Shell/Pages/ContentFrame.aspx?_a=Order&_v=PurchaseOrder-ObjectView&id=33950&customerid=5a6a2fd1-9fec-46d5-8e8b-5563b9bc1fa4

Exception Details: System.ArgumentOutOfRangeException: ArgumentOutOfRange_Index
Parameter name: index

[ArgumentOutOfRangeException: ArgumentOutOfRange_Index
Parameter name: index]
   Mediachase.Commerce.Storage.StorageCollectionBase.System.Collections.IList.get_Item(Int32 index) +266
   Mediachase.Commerce.Storage.MetaStorageCollectionBase`1.get_Item(Int32 index) +31
   Mediachase.Commerce.Manager.Apps.Order.CustomPrimitives.OrderStatus.LoadControlValues(Object Sender) +320
   Mediachase.BusinessFoundation.MetaForm.FormRenderer.stl_ItemCreated(SmartTableLayoutItemEventArgs e) +6093
   Mediachase.BusinessFoundation.SmartTableLayout.OnItemCreated(SmartTableLayoutItemEventArgs e) +33
   Mediachase.BusinessFoundation.SmartTableLayout.CreateItem(Int32 itemIndex, Guid uid, String title, TableCell containerCell, Boolean dataBind, Object dataItem) +172
   Mediachase.BusinessFoundation.SmartTableLayout.CreateControlHierarchy(IEnumerable dataSource, Boolean dataBinding) +3347
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   System.Web.UI.Control.DataBindChildren() +246
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +193
   Mediachase.BusinessFoundation.TableLayout.CreateItem(Int32 itemIndex, Guid uid, String title, HtmlGenericControl containerDiv, Boolean dataBind, Object dataItem) +190
   Mediachase.BusinessFoundation.TableLayout.CreateControlHierarchy(IEnumerable dataSource, Boolean dataBinding) +4039
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.BusinessFoundation.MetaForm.FormRenderer.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1582
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.Ibn.Web.UI.MetaUI.FormDocumentView.DataBind() +929
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +190
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.BusinessFoundation.XmlFormBuilder.OnInnerDataBind(Object sender, EventArgs e) +43
   Mediachase.BusinessFoundation.XmlFormBuilder.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +75
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.Page_Load(Object sender, EventArgs e) +1592
   System.Web.UI.Control.OnLoad(EventArgs e) +103
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3811

Some orders work and some don't. Any ideas?

Thanks!

/Kristoffer

Commerce 10.5

#183223
Edited, Oct 09, 2017 13:13
Vote:
 

Hello Kristoffer

I have seen those errors when the shipments are out of sync. The sad truth is that shipments are associated to lineitems with a string field that contains the index of the lineitem in its order form and the amount of items in the shipment. Since it is a free text field there are no database checks for consistency.

As a rule i would have to say don't allow for lineitem deletes once a shipment is created.

I am not at all sure that this is the problem you are having, but that is the case in which I have seen an ArgumentOutOfRangeException in Commerce Manager.

/EN

#183236
Oct 09, 2017 15:27
Vote:
 

Ok. It looks like we create a new shipment and clears the old one on checkout so I think that should be ok. Meaning that the line items in the cart when the checkout is started cannot be modified. It is a strange error. Do you know if there is a "db-script"-workaround? The reports does not work as well since there are corrupted orders.

/Kristoffer

#183241
Oct 09, 2017 16:36
Vote:
 

https://www.dropbox.com/s/hyh5jcgtg4mw4qs/Mediachase.ConsoleManager.pdb?dl=0 

Can you drop this into your bin folder and try to reproduce the exception again? this would include the code line in the exception, and is easier for us to guess why it happens

#183242
Oct 09, 2017 16:36
Vote:
 

You don't have any updates to lineitems after checkout?

Like from an integration to another system that handles packaging/delivery?

#183245
Oct 09, 2017 16:40
Vote:
 

Do I need to do anything more? The excepetion is still the same as I can see even with the pdb in the bin folder?

#183246
Oct 09, 2017 16:43
Vote:
 

Not really, it should have the line of code instead of +266. You might need to turn on the debug mode in web.config, but I don't think that is needed.

#183247
Oct 09, 2017 16:46
Vote:
 

Hmm... No luck.

I tried to generate my own pdb and got this, but I don't think it is better or maybe it is?

[ArgumentOutOfRangeException: ArgumentOutOfRange_Index
Parameter name: index]
   Mediachase.Commerce.Storage.StorageCollectionBase.System.Collections.IList.get_Item(Int32 index) +266
   Mediachase.Commerce.Storage.MetaStorageCollectionBase`1.get_Item(Int32 index) +31
   Mediachase.Commerce.Manager.Apps.Order.CustomPrimitives.OrderStatus.LoadControlValues(Object Sender) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\40\34a42624\OrderStatus.cs:93
   Mediachase.BusinessFoundation.MetaForm.FormRenderer.stl_ItemCreated(SmartTableLayoutItemEventArgs e) +6093
   Mediachase.BusinessFoundation.SmartTableLayout.OnItemCreated(SmartTableLayoutItemEventArgs e) +33
   Mediachase.BusinessFoundation.SmartTableLayout.CreateItem(Int32 itemIndex, Guid uid, String title, TableCell containerCell, Boolean dataBind, Object dataItem) +172
   Mediachase.BusinessFoundation.SmartTableLayout.CreateControlHierarchy(IEnumerable dataSource, Boolean dataBinding) +3347
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   System.Web.UI.Control.DataBindChildren() +246
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +193
   Mediachase.BusinessFoundation.TableLayout.CreateItem(Int32 itemIndex, Guid uid, String title, HtmlGenericControl containerDiv, Boolean dataBind, Object dataItem) +190
   Mediachase.BusinessFoundation.TableLayout.CreateControlHierarchy(IEnumerable dataSource, Boolean dataBinding) +4039
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.BusinessFoundation.MetaForm.FormRenderer.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1582
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.Ibn.Web.UI.MetaUI.FormDocumentView.DataBind() in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\3e\feecdec5\FormDocumentView.cs:150
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:273
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:276
   Mediachase.BusinessFoundation.XmlFormBuilder.OnInnerDataBind(Object sender, EventArgs e) +43
   Mediachase.BusinessFoundation.XmlFormBuilder.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +75
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.Page_Load(Object sender, EventArgs e) in C:\Users\Kiwi.SIT\AppData\Local\JetBrains\Shared\v03\DecompilerCache\decompiler\2D12B082-B9C6-4C49-B496-3D91C5A8BB9B\4a\c7c49a77\OrderView.cs:163
   System.Web.UI.Control.OnLoad(EventArgs e) +103
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3811
#183249
Oct 09, 2017 17:16
Vote:
 

Are you sure it's 10.5.0 version? Do you have customization in Commerce Manager? 

#183253
Oct 09, 2017 19:58
Vote:
 

No, sorry. It is 10.5.1. And we have not customized the Manager.

/Kristoffer

#183262
Oct 09, 2017 22:07
Vote:
 

https://www.dropbox.com/s/dcz047po4qedy02/Mediachase.ConsoleManager.pdb?dl=0

Next time I will make you buy candies!

#183263
Oct 09, 2017 22:13
Vote:
 

No worries, what candy do you like?

Still the same though, strange. Web.Config:

<compilation defaultLanguage="c#" debug="true" optimizeCompilations="false" targetFramework="4.5.2">

Version: 10.5.1.2349

Am I missing something maybe?

#183265
Oct 09, 2017 22:35
Vote:
 

That's very strange.

You can probably identify the "faulty" order, load it using the APIs then serialize to JSON/XML, remove the sensitive information and post it here 

#183273
Oct 10, 2017 9:34
Vote:
 

Looks like there is no OrderForm? the ecf_Load_OrderGroup gived me nothing but an ordergroupid.

select * from OrderGroup where OrderGroupId = 33950

Gives me one row

select * from OrderForm where OrderGroupId = 33950

Gives me nothing? How is that possible?

Can you delete an orderform by code without getting a warning? We had a bug where each session created a cart and to get rid of these I excuted the ecf_OrderGroup_Delete for all those carts by if these carts would have been included I guess they also would have been removed from OrderGroup.

I'm starting to think that I missed something while trying to delete all empty carts and accidently delete valid order forms.

/Kristoffer

#183343
Oct 11, 2017 16:04
Vote:
 

It is possible to delete an OrderForm without a warning. However that would be very sneaky ...

Are you sure that the database is in correct, healthy state? 

#183344
Oct 11, 2017 16:06
Vote:
 

What result do you get if you run:

select * from LineItem where OrderGroupId = 33950

Does that also give results?

If you do get lineitems what OrderFormId does they have and does it still exist?

#183376
Oct 12, 2017 13:01
Vote:
 

Yes Quan, the database is fine. Everything works at the moment so all new orders are correct.

Nope, nothing in LineItems. 

I guess I must have done something wrong while deleting old carts.

/Kristoffer

#183378
Oct 12, 2017 13:05
Vote:
 

Most likely but i do wonder why ecf_OrderGroup_Delete failed to delete your ordergroup if it managed to remove all the content.

#183379
Oct 12, 2017 13:10
Vote:
 

Probably not... Before I found the stored procedure I tried some delete actions that failed. cannot remember what but I guess I did something stupid there without knowing...

Well, well. Note to self, do not fuck up database with own written scripts... :)

#183380
Oct 12, 2017 13:38
Vote:
 

That's what we have been trying to say - direct data manipulation should be avoided unless absolutely necessary. And even in that case, proceed with extreme care. 

#183382
Oct 12, 2017 13:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.