error when going to the cart 4.4 site

1 week ago
When I go the cart on my dev site, I am getting the error occurred page. Checking the logs you can see below.  

this part seems significant.

C:\live\sites\nop44\Themes\CentralCrafts\Views\Shared\Components\OrderSummary\Default.cshtml:line 120

looking at that code , it seems somethign to do with url records in the cart? the product urls seem ok.  Can anyone shed some light?




                                    @if (Model.IsEditable && item.AllowItemEditing)
                                    {
                                        var editCartItemUrl = Url.RouteUrl("Product", new { SeName = item.ProductSeName });
                                        editCartItemUrl = webHelper.ModifyQueryString(editCartItemUrl, "updatecartitemid=" + item.Id, null);
                                        <div class="edit-item" style="display:none;">
                                            <a href="@editCartItemUrl">@T("Common.Edit")</a>
                                        </div>





Log level
Error
Short message

String cannot be of zero length. (Parameter 'oldValue')
Full message
System.ArgumentException: String cannot be of zero length. (Parameter 'oldValue')
   at System.String.Replace(String oldValue, String newValue)
   at Nop.Core.WebHelper.ModifyQueryString(String url, String key, String[] values) in D:\subrata_running_project\CentralCrafts_4.40.3\Libraries\Nop.Core\WebHelper.cs:line 307
   at AspNetCore.Themes_CentralCrafts_Views_Shared_Components_OrderSummary_Default.<ExecuteAsync>b__16_0() in C:\live\sites\nop44\Themes\CentralCrafts\Views\Shared\Components\OrderSummary\Default.cshtml:line 120
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.GetChildContentAsync(Boolean useCachedResult, HtmlEncoder encoder)
   at Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
   at AspNetCore.Themes_CentralCrafts_Views_Shared_Components_OrderSummary_Default.ExecuteAsync() in C:\live\sites\nop44\Themes\CentralCrafts\Views\Shared\Components\OrderSummary\Default.cshtml:line 17
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ExecuteAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
   at AspNetCore.Themes_CentralCrafts_Views_ShoppingCart_Cart.ExecuteAsync() in C:\live\sites\nop44\Themes\CentralCrafts\Views\ShoppingCart\Cart.cshtml:line 19
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at WebMarkupMin.AspNetCore5.WebMarkupMinMiddlewareBase.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 125
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Nop.Services.Authentication.AuthenticationMiddleware.InvokeAsync(HttpContext context) in D:\subrata_running_project\CentralCrafts_4.40.3\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 94
   at FoxNetSoft.Plugin.Misc.CDNConnector.Infrastructure.CDNConnectorMiddleware.Invoke(HttpContext context)
   at FoxNetSoft.Plugin.Misc.RedirectManager.Infrastructure.PageManagerMiddleware.InvokeAsync(HttpContext context, IStoreContext storeContext, RedirectManagerSettings redirectManagerSettings)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Services.Installation.InstallUrlMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper) in D:\subrata_running_project\CentralCrafts_4.40.3\Libraries\Nop.Services\Installation\InstallUrlMiddleware.cs:line 53
   at Nop.Services.Common.KeepAliveMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper) in D:\subrata_running_project\CentralCrafts_4.40.3\Libraries\Nop.Services\Common\KeepAliveMiddleware.cs:line 50
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

1 week ago
Have you customised the code ?

I dont know if this is the issue but normally this line is

editCartItemUrl = webHelper.ModifyQueryString(editCartItemUrl, "updatecartitemid", item.Id.ToString());
1 week ago
Thank you Yidna, that is very helpful. Let me try reverting that code then. We have had some changes but normally there would be a comment in this case, let me give it a shot and I will report back !
5 days ago
This line was added and we are back to the races.

@if (Model.IsEditable && item.AllowItemEditing && 1==0)

just in case it helps anyone.
5 days ago
OK, but  " && 1==" is just making it not execute the code at all.  I think Yidna's was pointing out that your call to ModifyQueryString has
  ..., null);
when it should be
  ...", item.Id.ToString());
5 days ago
Thanks, well there was quite a bit of custom code in relation to associated products and I guess as a result some related to the cart. 



We are coming off a big upgrade from 3.8 to 4.4 - with that change its working again and so far I cant see any negative issues.



I will keep an eye on it  as you pointed out there might have been the inention to do something there.  But it could have been just a bug.
5 days ago
Do you enable editing in the cart - maybe you don’t allow ?
If so,
- Add something to the Cart with attributes
- Then click the edit button
- See if it goes back to the product with the previously selected attributes
5 days ago
hmm I am probably being a plonker here I am  not familiar with this setting. When you say editing of cart you mean update qty and removal of items? Could you tell me where the setting is to enable / disable please?
4 days ago
It relates to editing of the product attributes and details entered on the product page before the add to cart

Clicking the link that is displayed in the cart under each product sends the user back to the product page to show the previous values selected and make adjustments

See Configuration > Shopping Cart Settings
- Set Allow cart item editing
4 days ago
Ahh yes, I understand now and I am not sure how I missed that setting when I Checked last night. It is enabled and the link does go back to the correct product from the cart,  Yay!

So presumably the functionality that was apparently removed has been implemented elsewhere, which makes sense as we have some associated products code changes that would definitley affect the cart url, this is very good to know! Was that what you were testing for? Many thanks for your continued help with this by the way 🙂