Try our conversational search powered by Generative AI!

Unable to cast string to SpecializedProperties.ItemCollection [11.8.3]

Vote:
 

Upgraded from Commerce 10.4.3 to 11.8.3. Now I'm getting the error below when trying to access purchase orders with status "In progress" in Commerce Manager orders view. All PO's with other statuses are accessible. Any tips to point me in the right direction?

There is only one language activated in CMS (Norwegian), therefore the catalog only has this as well.

Url	https://manager.example.com:443/Apps/Shell/Pages/ContentFrame.aspx?_a=Order&_v=PurchaseOrder-ObjectView&id=65638&customerid=42433bdb-ae2a-4abf-8bee-8c09e2e8b1a5

Referer	https://manager.example.com/Apps/Shell/Pages/default.aspx
Unable to cast object of type 'System.String' to type 'EPiServer.Commerce.SpecializedProperties.ItemCollection`1[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.String' to type 'EPiServer.Commerce.SpecializedProperties.ItemCollection`1[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.String' to type 'EPiServer.Commerce.SpecializedProperties.ItemCollection`1[System.String]'.]
   Castle.Proxies.CatalogContentProxy.get_CatalogLanguages() +199
   EPiServer.Commerce.Catalog.Internal.CatalogLanguageSettingsResolver.GetLanguageSettingForCatalog(Int32 catalogId) +326
   EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThrough(IObjectInstanceCache cache, String key, Func`1 readValue, Func`2 evictionPolicy) +124
   EPiServer.Commerce.Catalog.Internal.CatalogLanguageSettingsResolver.Resolve(ContentReference contentLink) +465
   EPiServer.Core.Internal.DefaultContentLanguageSettingsHandler.GetSetting(ContentReference contentLink, HashSet`1 visitedContents) +41
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +84
   EPiServer.Core.Internal.DefaultContentLanguageSettingsHandler.Get(ContentReference contentLink) +12
   EPiServer.Core.Internal.DefaultContentLanguageSettingsHandler.Get(ContentReference contentLink, String languageBranch) +18
   EPiServer.Core.Internal.LanguagePipeline.Pipe(ContentReference contentLink, IContent contentInstance, LoaderOptions loaderOptions, Func`3 loadingDelegate) +271
   EPiServer.Core.Internal.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions) +466
   EPiServer.Core.Internal.DefaultContentLoader.TryGet(ContentReference contentLink, LoaderOptions loaderOptions, T& content) +584
   EPiServer.Core.Internal.DefaultContentLoader.Get(ContentReference contentLink, LoaderOptions loaderOptions) +99
   EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.TryGetTaxCategoryId(ILineItem item, Int32& taxCategoryId) +125
   EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.CalculateTaxTotal(IOrderForm orderForm, IMarket market, Currency currency, Func`3 getShippingTotalFunc, Boolean isReturn) +747
   EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.CalculateTaxTotal(IOrderForm orderForm, IMarket market, Currency currency) +154
   EPiServer.Commerce.Order.Calculator.DefaultTaxCalculator.GetTaxTotal(IOrderForm orderForm, IMarket market, Currency currency) +367
   EPiServer.Commerce.Order.Calculator.DefaultOrderFormCalculator.CalculateTotal(IOrderForm orderForm, IMarket market, Currency currency) +355
   EPiServer.Commerce.Order.Calculator.DefaultOrderFormCalculator.GetTotal(IOrderForm orderForm, IMarket market, Currency currency) +367
   EPiServer.Commerce.Order.Calculator.<>c__DisplayClass7_0.b__0(IOrderForm x) +94
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +227
   System.Linq.Enumerable.Sum(IEnumerable`1 source) +98
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.CalculateTotal(IOrderGroup orderGroup) +251
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.GetTotal(IOrderGroup orderGroup) +216
   EPiServer.Commerce.Order.IPurchaseOrderExtensions.IsPaid(IPurchaseOrder purchaseOrder, IOrderGroupCalculator orderGroupCalculator) +533
   Mediachase.Commerce.Manager.Order.CommandHandlers.PurchaseOrderHandlers.PickupOrderHandler.IsCommandEnable(IOrderGroup order, CommandParameters cp) +281
   Mediachase.Commerce.Manager.Apps.Order.CommandHandlers.OrderGroupHandlers.OrderGroupCommandHandlerBase.IsEnable(Object sender, Object element) +110
   Mediachase.BusinessFoundation.CommandHandler.IsCommandEnableHandler(Object Sender, Object Command, Object Argument) +662
   Mediachase.BusinessFoundation.CommandManager.IsEnable(String commandName, Dictionary`2 listParams) +341
   Mediachase.BusinessFoundation.CommandManager.AddCommand(String className, String viewName, String placeName, CommandParameters cp, Boolean& isEnabled) +296
   Mediachase.Commerce.Manager.Apps.Core.Controls.ButtonsHolder.GetButtonsFromOM(ButtonSet buttonSet) +1303
   Mediachase.Commerce.Manager.Apps.Core.Controls.ButtonsHolder.BindHolder() +422
   System.Web.UI.Control.OnLoad(EventArgs e) +103
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1381
#190685
Apr 16, 2018 8:37
Vote:
 

Seeing as 

CatalogLanguageSettingsResolver.GetLanguageSettingForCatalog

is a pure function with just a few injected dependencies, I'd try to decompile the method and debug it in your startcontroller or wherever convenient. It only takes a catalogId as parameter, so check your database for all catalogIds and try to replicate the behaviour and dig deeper from there :)

#190689
Apr 16, 2018 9:46
Vote:
 

Hi,

That is very strange. I would suggest you to create a Commerce Manager 11.8.3 site from scratch and try it (use your connectionStrings) to see if it still happens. If it does, you probably need to contact our developer support service.

#190691
Apr 16, 2018 9:57
Vote:
 

Thanks both for great input.

The problem is now resolved, but I can't pinpoint exactly what the disruptive element was. The solution implemented a custom extension of SpecializedProperties.ItemCollection<string> with an implicit operator in charge of converting string to previously mentioned custom type. I tried tuning this conversion to prevent the 500-error, but to no luck. I ended up removing the custom type all together and have not encountered the issue since.

#190800
Apr 17, 2018 10:35
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.