November Happy Hour will be moved to Thursday December 5th.

Exception i SaveCartAsPurchaseOrder, SerializedCart [11.3]

Vote:
 

Hi!

I sometimes get this expection when I try to create a purchase order from a SerializedCart:

[ArgumentNullException: Value cannot be null.
Parameternamn: value]
   System.Web.Caching.CacheEntry..ctor(String key, Object value, CacheDependency dependency, CacheItemRemovedCallback onRemovedHandler, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, Boolean isPublic, CacheInternal cache) +1843728
   System.Web.Caching.CacheInternal.DoInsert(Boolean isPublic, String key, Object value, CacheDependency dependencies, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback, Boolean replace) +139
   System.Web.Caching.AspNetCache.Insert(String key, Object item, CacheInsertOptions options) +130
   System.Web.Caching.Cache.Insert(String key, Object value, CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration) +132
   EPiServer.Framework.Cache.HttpRuntimeCache.Insert(String key, Object value, CacheEvictionPolicy evictionPolicy) +337
   Mediachase.MetaDataPlus.Configurator.MetaDataTypes.GetDatabaseValueStringDictionary(MetaDataContext context, MetaObject metaObject, Nullable`1 workId, MetaField metaField, Object value) +171
   Mediachase.MetaDataPlus.MetaObject.GetMetaObjectUpdateParameters(MetaDataContext context) +281
   Mediachase.MetaDataPlus.MetaObject.AcceptChanges(MetaDataContext context) +143
   Mediachase.Commerce.Storage.MetaStorageBase.AcceptChanges(MetaDataContext context, Boolean saveSystem) +334
   Mediachase.Commerce.Orders.OrderForm.AcceptChanges() +243
   Mediachase.Commerce.Storage.MetaStorageCollectionBase`1.AcceptChanges() +841
   Mediachase.Commerce.Orders.OrderGroup.AcceptChanges() +149
   Mediachase.Commerce.Orders.PurchaseOrder.AcceptChanges() +230
   EPiServer.Commerce.Order.PurchaseOrderProvider.Save(IPurchaseOrder purchaseOrder) +80
   EPiServer.Commerce.Order.Internal.SerializableCartProvider.SaveAsPurchaseOrder(ICart cart) +508
   EPiServer.Commerce.Order.DefaultOrderRepository.SaveAsPurchaseOrder(IOrderGroup orderGroup) +432
   Designonline.Site.Features.Checkout.Controllers.CheckoutController.PrepareAndCreateOrder(ICart klarnaCheckoutCart) in D:\Projekt\Scandinavian Design Online\Development\ScandinavianDesignCenter\Sources\Designonline.Site\Features\Checkout\Controllers\CheckoutController.cs:1546
   Designonline.Site.Features.Checkout.Controllers.CheckoutController.Finish(CheckoutPage currentPage, ICart klarnaCheckoutCart) in D:\Projekt\Scandinavian Design Online\Development\ScandinavianDesignCenter\Sources\Designonline.Site\Features\Checkout\Controllers\CheckoutController.cs:1492
   Designonline.Site.Features.Checkout.Controllers.CheckoutController.KlarnaPush(CheckoutPage currentPage, String klarnaOrder, String orderGroupId) in D:\Projekt\Scandinavian Design Online\Development\ScandinavianDesignCenter\Sources\Designonline.Site\Features\Checkout\Controllers\CheckoutController.cs:1967
   lambda_method(Closure , ControllerBase , Object[] ) +240
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
   System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +71
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +72
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +385
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +38
   System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134

It seems to have something to do with the Metadata but there is only one "value cannot be null" property and that one has a value.
The exception looks like it occours when it tries to cache some Metadata?

Any suggestions?

Thanks!

/Kristoffer

#185203
Nov 11, 2017 2:18
Vote:
 

Hi,

Can you post how does your cart look like? 

#185207
Nov 11, 2017 13:23
Vote:
 

Hi!

This json gives me the cache error:

{  
   "Id":1,
   "Created":"2017-11-10T19:04:01.513Z",
   "Currency":"SEK",
   "CustomerId":"dcb01835-895a-4025-8c74-8c9d2181903c",
   "Forms":[  
      {  
         "OrderFormId":-1,
         "AuthorizedPaymentTotal":0.0,
         "CapturedPaymentTotal":0.0,
         "HandlingTotal":0.0,
         "Name":"Default",
         "Shipments":[  
            {  
               "ShipmentId":-1,
               "ShippingMethodId":"d9188b0b-ab86-4113-8960-75e4181896ed",
               "ShippingMethodName":null,
               "ShippingAddress":{  
                  "Id":"e0bf678b-2815-41d2-b225-6283bf37a2d9",
                  "FirstName":"Kristoffer",
                  "LastName":"Lindén",
                  "Organization":"",
                  "Line1":"Allmoge",
                  "Line2":null,
                  "City":"Spånga",
                  "CountryCode":"SWE",
                  "CountryName":"SWE",
                  "PostalCode":"12345",
                  "RegionCode":null,
                  "RegionName":null,
                  "DaytimePhoneNumber":"070 830 82 84",
                  "EveningPhoneNumber":null,
                  "FaxNumber":null,
                  "Email":"kristoffer@authority.se",
                  "Properties":{  

                  }
               },
               "ShipmentTrackingNumber":null,
               "OrderShipmentStatus":1,
               "PickListId":null,
               "WarehouseCode":"default",
               "LineItems":[  
                  {  
                     "LineItemId":-1,
                     "Code":"29449-01",
                     "DisplayName":null,
                     "PlacedPrice":559.2,
                     "Quantity":1.0,
                     "ReturnQuantity":0.0,
                     "InventoryTrackingStatus":0,
                     "IsInventoryAllocated":false,
                     "IsGift":false,
                     "Properties":{  

                     },
                     "AllowBackordersAndPreorders":false,
                     "InStockQuantity":0.0,
                     "BackorderQuantity":0.0,
                     "PreorderQuantity":0.0,
                     "InventoryStatus":0,
                     "MaxQuantity":0.0,
                     "MinQuantity":0.0,
                     "EntryAmount":0.0,
                     "OrderAmount":0.0
                  },
                  {  
                     "LineItemId":-2,
                     "Code":"28662-01",
                     "DisplayName":null,
                     "PlacedPrice":199.2,
                     "Quantity":1.0,
                     "ReturnQuantity":0.0,
                     "InventoryTrackingStatus":0,
                     "IsInventoryAllocated":false,
                     "IsGift":false,
                     "Properties":{  

                     },
                     "AllowBackordersAndPreorders":false,
                     "InStockQuantity":0.0,
                     "BackorderQuantity":0.0,
                     "PreorderQuantity":0.0,
                     "InventoryStatus":0,
                     "MaxQuantity":0.0,
                     "MinQuantity":0.0,
                     "EntryAmount":0.0,
                     "OrderAmount":0.0
                  },
                  {  
                     "LineItemId":-3,
                     "Code":"25221-02",
                     "DisplayName":null,
                     "PlacedPrice":3119.2,
                     "Quantity":1.0,
                     "ReturnQuantity":0.0,
                     "InventoryTrackingStatus":0,
                     "IsInventoryAllocated":false,
                     "IsGift":false,
                     "Properties":{  

                     },
                     "AllowBackordersAndPreorders":false,
                     "InStockQuantity":0.0,
                     "BackorderQuantity":0.0,
                     "PreorderQuantity":0.0,
                     "InventoryStatus":0,
                     "MaxQuantity":0.0,
                     "MinQuantity":0.0,
                     "EntryAmount":0.0,
                     "OrderAmount":0.0
                  }
               ],
               "Properties":{  

               },
               "ShipmentDiscount":0.0,
               "OperationKeys":{  

               }
            }
         ],
         "Promotions":[  

         ],
         "CouponCodes":[  

         ],
         "Payments":[  
            {  
               "Amount":4847.0,
               "AuthorizationCode":null,
               "BillingAddress":{  
                  "Id":"a9e006c3-d0e6-418d-9735-4861b707f5ad",
                  "FirstName":"Kristoffer",
                  "LastName":"Lindén",
                  "Organization":"",
                  "Line1":"Allmoge",
                  "Line2":null,
                  "City":"Spånga",
                  "CountryCode":"SWE",
                  "CountryName":"SWE",
                  "PostalCode":"12345",
                  "RegionCode":null,
                  "RegionName":null,
                  "DaytimePhoneNumber":"070 830 82 84",
                  "EveningPhoneNumber":null,
                  "FaxNumber":null,
                  "Email":"kristoffer@authority.se",
                  "Properties":{  

                  }
               },
               "CustomerName":null,
               "ImplementationClass":null,
               "PaymentId":0,
               "PaymentMethodId":"e5448302-25f8-4ae4-90a7-bfa525f3ffdb",
               "PaymentMethodName":"KlarnaCheckout",
               "PaymentType":0,
               "ProviderTransactionID":null,
               "Status":"Pending",
               "TransactionID":null,
               "TransactionType":"Authorization",
               "ValidationCode":null,
               "Properties":{  

               }
            }
         ],
         "Properties":{  
            "SelectedServicePoint":[  
               {  
                  "Key":"pickupaddress",
                  "Value":"SPÅNGAVÄGEN 353"
               },
               {  
                  "Key":"pickupcountry",
                  "Value":"SE"
               },
               {  
                  "Key":"pickupagentno",
                  "Value":"SE-969800"
               },
               {  
                  "Key":"pickuppostcode",
                  "Value":"16355"
               },
               {  
                  "Key":"pickupaddress2",
                  "Value":""
               },
               {  
                  "Key":"pickupname",
                  "Value":"NÄLSTA VIDEO"
               },
               {  
                  "Key":"pickupcity",
                  "Value":"SPÅNGA"
               },
               {  
                  "Key":"pickupparid",
                  "Value":""
               }
            ]
         }
      }
   ],
   "Market":"SV",
   "Modified":"2017-11-11T15:18:23.6357023Z",
   "Name":"Default",
   "Notes":[  

   ],
   "OrderLink":{  
      "OrderGroupId":1,
      "Name":"Default",
      "CustomerId":"dcb01835-895a-4025-8c74-8c9d2181903c",
      "OrderType":"EPiServer.Commerce.Order.Internal.SerializableCart, EPiServer.Business.Commerce, Version=11.3.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"
   },
   "OrderStatus":4,
   "Organization":null,
   "Properties":{  
      "OrderConfirmationShown":true,
      "TaxRate":"25",
      "TrackingNumber":"T1",
      "KlarnaCheckoutOrder":"7ZRFUDMB5FR7LIVMAMHEVYOP6XQ"
   }
}



Thanks!

/Kristoffer

#185213
Nov 11, 2017 16:27
Vote:
 

I think SelectedServicePoint is suspicious here. I can't say anything for sure without the database, so I would suggest you to contact developer support service and file a support ticket.

#185249
Nov 13, 2017 15:34
Vote:
 

Looks like you are right. If I use a shipment method withour pickup point the SaveAsPurchaseOrder works just fine.

I have send an email to developer support.

/Kristoffer

#185267
Nov 13, 2017 23:03
Vote:
 

I created a new property as LongString an serialized the values to json instead and then it works fine. I guess there must be something with serializing the MetaDictionary datatype.

/Kristoffer

#185284
Nov 14, 2017 12:34
* 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.