An error occurred
Object must implement IConvertible.
Exception Details
System.InvalidCastException, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Object must implement IConvertible.at Vendr.Infrastructure.Resiliency.PollyExecutionStrategyBase.Execute[TResult](Func1 operation, Func1 verifySucceeded)
at Vendr.Core.VendrUnitOfWorkProvider.Execute[T](IUnitOfWorkOptions options, Func2 action)
at Vendr.Core.VendrUnitOfWorkProvider.Execute[T](Func2 action)
at Vendr.Umbraco.Web.Controllers.VendrCartController.CalculateCart(CartSaveDto cart)
at lambdamethod2241(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
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.Awaited|260(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
I have created products (both standalone and variant products), added them to the cart, then defined a 20% discount with the exact same config and I am able to apply it and remove it no problem.
Could there be something else at play? Doe you have any event handlers that run at all?
Vendr discount codes
Hi,
I have created a new discount code with 20% off. See below screenshot.
If I then try to apply the discount code of SUMMER20 in the cart I'm getting below error. And the discount is not being applied.
Thanks Stewart
Hi Stewart,
Can you paste the actual stack trace text? It's hard to read in a compressed image.
Here you go
Exception Details System.InvalidCastException, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Object must implement IConvertible.at Vendr.Infrastructure.Resiliency.PollyExecutionStrategyBase.Execute[TResult](Func
1 operation, Func
1 verifySucceeded) at Vendr.Core.VendrUnitOfWorkProvider.Execute[T](IUnitOfWorkOptions options, Func2 action) at Vendr.Core.VendrUnitOfWorkProvider.Execute[T](Func
2 action) at Vendr.Umbraco.Web.Controllers.VendrCartController.CalculateCart(CartSaveDto cart) at lambdamethod2241(Closure , Object , Object[] ) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() --- End of stack trace from previous location --- 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.Awaited|260(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)Hmmm, I don't seem to be able to replicate this.
I have created products (both standalone and variant products), added them to the cart, then defined a 20% discount with the exact same config and I am able to apply it and remove it no problem.
Could there be something else at play? Doe you have any event handlers that run at all?
Hi,
Below shows where the error is being thrown locally. I've not got any event handlers setup.
Seems be an issue with converting Guid to IConvertible.
What database are you running on?
I'm using Microsoft SQL Server 2019 (RTM-GDR) (KB5014356) - 15.0.2095.3 (X64)
Provider is "umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient"
Ok, I’m using SQLite locally so I’ll have to test on Sql Server tomorrow.
I know we have an explicit converter for SQLite but I was under the impression SQL server didn’t need it.
Ok, so I've managed to test it and replicate the issue locally on SQL Server.
I'm not exactly sure what is causing the error but I've managed to find an alternative approach that looks to resolve the issue.
I've just pushed an update to our unstable feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json so if you want to test version 3.0.2-beta0002 and see if that resolves the issue for you that would be great.
Thanks Matt, I've just come across this exact same issue on SQL Server and I can confirm it is working fine in 3.0.2-beta0002!
Perfect!
Thanks for confirming
I'll get this released early next week 👍
is working on a reply...