Developer forum

Forum » Dynamicweb 10 » Currency Null error when trying to open product

Currency Null error when trying to open product

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a list of products in a fresh DW install (DW 10.16.5).
The setup was clean, no starter pack or anything.
I could create a few products, I have managed to import a few products.
When I access the All products list and I try to open a product (click on the product) I get an exception:

2025-06-25 20:02:13.7383: Request failed. Trace ID: 00-2bdf6f8280c1b960efcc499de31ac34c-248e44b7a9be6be0-00. System.ArgumentNullException: Value cannot be null. (Parameter 'currency')
   at System.ArgumentNullException.Throw(String paramName)
   at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
   at Dynamicweb.Ecommerce.International.CurrencyService.Format(Currency currency, Double value, Boolean showSymbol)
   at Dynamicweb.Products.UI.Models.ProductCardInfo..ctor(ProductDataModel model)
   at Dynamicweb.Products.UI.Screens.ProductOverviewScreen.GetInfoCardWidget(ProductDataModel model, Nullable`1 presetId)
   at Dynamicweb.Products.UI.Screens.ProductOverviewScreen.AddOverviewComponents(ProductDataModel model)
   at Dynamicweb.Products.UI.Screens.ProductOverviewScreen.BuildOverviewScreen()
   at Dynamicweb.CoreUI.Screens.OverviewScreenBase`1.GetDefinitionInternal()
   at Dynamicweb.Management.UI.Controllers.AdminController.GetLayoutDefinition(String screenDefinition, String shadowEditId)
   at Dynamicweb.Management.UI.Controllers.AdminController.GetScreen(String layout, String navigationPath, String shadowEditId)
   at Dynamicweb.Management.UI.Controllers.AdminController.GetUI()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_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()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Dynamicweb.Management.UI.Middleware.AdminUIRedirectMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
2025-06-25 20:02:13.7408: Request headers: [
  "Accept",
  "Accept-Encoding",
  "Accept-Language",
  "Connection",
  "Cookie",
  "Host",
  "Referer",
  "User-Agent",
  "sec-ch-ua-platform",
  "dw-screen-only",
  "sec-ch-ua",
  "dw-navigation-path",
  "sec-ch-ua-mobile",
  "sec-fetch-site",
  "sec-fetch-mode",
  "sec-fetch-dest",
  "priority"
]
2025-06-25 20:02:13.7412: Request item keys: [
  "DW_Current_ExecutionTable"
]
2025-06-25 20:02:13.7415: Request form: []

If I click on Edit, I can open the product, edit properties and save it again but the error on click-to-open is not going away.
I have set a currency in the system.
While writing this post, I realised that I may need to set the currency as "Default". Which I did, and the error is now gone.

But I still believe this approach should be captured and accounted for.
If you create the first currency in the system, it should be automatically marked as "Default" to the logic to retrieve the currency should either use the first Currency or warn the user that they need to set a Default currency. 

I hope this helps.

Thank you,
Adrian


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Adrian

Thank you for reporting. I believe this has just been handled and will roll out next week.

I will have QA look into the creation of the first currency and ensure that is set as default for the first currency record.

BR Nicolai

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi,

I see that first added currency is not marked as default in fact, so I've reproduced exception on adding new product or viewing\editing of an one added via import. Actually the exception has details about cause as follows: "No default currency found. Please ensure that there is a currency which is marked as default." but I'm agree that we have to avoide this. So, new task #24754 has been created to implement the suggested logic above. Thanks.

BR, Oleg QA 

 

You must be logged in to post in the forum