Discussions

Ask a Question
Back to All

iMIS cart.AddItem() throws error

We think this has to do with a shipping method and/or payment method or "something" in the cart AddItem process that is required, but not present. However - code has been running fine for years. Someone DID remove Shipping Methods, and we see that Payment Details on the Cart_Home page is missing. The item gets added, but no pricing is there either.

cart.AddItem("PRODUCTCODE", Convert.ToDecimal(quantity)); //pseudo

The failure occurs in the Asi.Client.ServiceModel dll v20.2.49.5903

Any idea how to trace down this error. I can manipulate the cart further and see which objects are present at the time of the call. Here is the stack trace:

Error: Service Error: Object reference not set to an instance of an object.
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.ServiceModel.FaultException: Error: Service Error: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FaultException: Error: Service Error: Object reference not set to an instance of an object.
]
Asi.Soa.ClientServices.CartManager.AddLine(OrderLineData line, Uri websiteEditUrl) +497
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId, String orderLineNote) +755
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode, String shipToPartyId) +97
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl, String sourceCode) +88
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity, Uri websiteEditUrl) +79
Asi.Soa.ClientServices.CartManager.AddItem(String itemId, Decimal quantity) +67
USPTA_InsurancePurchase.USPTA_InsurancePurchaseDisplay.btnCheckout_Click(Object sender, EventArgs e) in c:\Users\ascension\Source\Repos\uspta\USPTA_InsurancePurchase\USPTA_InsurancePurchase\USPTA_InsurancePurchaseDisplay.ascx.cs:553
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11765069
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1665