Commerce Manager R2SP2 InvalidCastException while Executing Order Workflow

Vote:
 

Hello Guys,

I am facing wiered problem. When I try to view order details of orders which are made from Commerce Manage, I see below error.

Can anyone give me idea what is happening and what I need to do.

Unable to cast object of type 'System.DBNull' to type 'System.String'. 
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.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

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: 


[InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.]
   Mediachase.Commerce.Orders.OrderContext.GetTaxes(Guid siteId, String taxCategory, String languageCode, String countryCode, String stateProvinceCode, String zipPostalCode, String district, String county, String city) +445
   Mediachase.Commerce.Workflow.Activities.CalculateTaxActivity.CalculateSaleTaxes() +1310
   Mediachase.Commerce.Workflow.Activities.CalculateTaxActivity.Execute(ActivityExecutionContext executionContext) +168
   System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) +49
   System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) +57
   System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) +4176657
   System.Workflow.Runtime.Scheduler.Run() +948

[ApplicationException: Workflow generated an exception, please look at the previous error for more details.]
   Mediachase.Commerce.Orders.Managers.OrderGroupWorkflowManager.RunWorkflow(OrderGroup orderGroup, String name, Boolean async, Boolean throwException, Dictionary`2 param) +1050
   Mediachase.Commerce.Orders.Managers.OrderStatusManager.IsOrderPaid(PurchaseOrder purchaseOrder) +699
   Mediachase.Commerce.Manager.Order.CommandHandlers.PurchaseOrderHandlers.ReleaseShipmentHandler.IsCommandEnable(OrderGroup order, CommandParameters cp) +201
   Mediachase.Commerce.Manager.Apps.Order.CommandHandlers.OrderGroupHandlers.OrderGroupCommandHandlerBase.IsEnable(Object sender, Object element) +103
   Mediachase.BusinessFoundation.CommandHandler.IsCommandEnableHandler(Object Sender, Object Command, Object Argument) +1389
   Mediachase.BusinessFoundation.CommandManager.IsEnable(String commandName, Dictionary`2 listParams) +632
   Mediachase.BusinessFoundation.CommandManager.AddCommand(String className, String viewName, String placeName, CommandParameters cp, Boolean& isEnabled) +595
   Mediachase.Commerce.Manager.Apps.Core.Controls.ButtonsHolder.GetButtonsFromOM(ButtonSet buttonSet) +1363
   Mediachase.Commerce.Manager.Apps.Core.Controls.ButtonsHolder.BindHolder() +461
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5483 
#114317
Dec 10, 2014 7:59
Vote:
 

Its Weird, This looks to me related with Taxes setup.

Can you check that your taxes have some value in Name/Display name? if not assign some value and try again.

or in sql run ecf_GetTaxes by assigning same values as you are passing to this function and see what taxes it is returning. 

Regards

/K

#114448
Dec 11, 2014 17:57
Vote:
 

Hi K,

The problem is not occurding everywhere, It's only on some browsers.

Your anwer helped us to investigate in right direction.

ecf_GetTaxes has a parameter language culture and this value is an input from Browser culture. So if order was made from somebody sitting in UK and then somebody from US will try to view the order, it will throw the exception, because en-US culture is passed to this SP.

Thanks for your help

Shaan

#114471
Dec 12, 2014 10:52
Vote:
 

I guess one of these properties of the Shipping address might be null instead of empty: CountryCode, State, PostalCode, RegionCode, City. But we need to find out why it is null. Do you have any modification to the Workflow/Activities package?

#114935
Jan 05, 2015 3:45
Vote:
 

Ah, now I see your previous post, regarding the conflict between cultures :)

#114936
Jan 05, 2015 3:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.