Prices Include Tax Error on Upgrade

Vote:
 

Hi,

I keep getting the error below after I upgraded our Episerver site to CMS 11.6.0 and Commerce 12.1.0. Does anybody have an idea on how to resolve this, please?

[InvalidCastException: Specified cast is not valid.]
   Mediachase.Commerce.Markets.Database.MarketRow.get_PricesIncludeTax() +68

[StrongTypingException: The value for column 'PricesIncludeTax' in table 'Market' is DBNull.]
   Mediachase.Commerce.Markets.Database.MarketRow.get_PricesIncludeTax() +163
   Mediachase.Commerce.Markets.Database.MarketServiceDatabase.DeserializeMarket(MarketRow marketRow) +280
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +238
   System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) +451
   Mediachase.Commerce.Markets.Database.MarketServiceDatabase.GetAllMarkets() +538
   Mediachase.Commerce.Markets.Database.MarketServiceCache.InternalMarkets() +51
   Mediachase.Commerce.Markets.Database.MarketServiceCache.get_Markets() +75
   Mediachase.Commerce.Catalog.ExcludedCatalogEntryMarketsField.GetMetaField(MetaDataContext context) +206
   Mediachase.MetaDataPlus.RequiredMetaFieldCollectionBase..ctor(IEnumerable`1 requiredFields) +191
   lambda_method(Closure , IBuildSession , IContext ) +211

[StructureMapBuildException: Error while building type Mediachase.Commerce.DefaultRequiredMetaFields.  See the inner exception for details
1.) new DefaultRequiredMetaFields()
2.) Mediachase.Commerce.DefaultRequiredMetaFields
3.) Instance of Mediachase.MetaDataPlus.IRequiredMetaFieldCollection (Mediachase.Commerce.DefaultRequiredMetaFields)
4.) Container.GetInstance(Mediachase.MetaDataPlus.IRequiredMetaFieldCollection)
]
   lambda_method(Closure , IBuildSession , IContext ) +1096
   StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) +142
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +71
   StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) +203
   StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) +175
   StructureMap.Container.GetInstance(Type pluginType) +358
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +54

[ActivationException: Activation error occurred while trying to get instance of type IRequiredMetaFieldCollection, key ""]
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +155
   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance() +54
   Mediachase.MetaDataPlus.Configurator.MetaClass.HandleRequiredFields(MetaDataContext context, MetaClass metaClass) +118
   Mediachase.MetaDataPlus.Configurator.MetaClass.LoadFromDb(MetaDataContext context, Func`2 dbLoader) +302
   EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThroughWithWait(IObjectInstanceCache cache, String cacheKey, Func`1 readValue, Func`2 evictionPolicy) +981
   Mediachase.MetaDataPlus.Configurator.MetaClass.ReadThroughCache(String cacheKey, MetaDataContext context, Func`2 dbLoader, Func`2 additionalCacheKeyCreator) +265
   Mediachase.MetaDataPlus.Configurator.MetaClass.Create(MetaDataContext context, String metaNamespace, String name, String friendlyName, String tableName, Int32 parentId, MetaClassType type, String description) +126
   Mediachase.MetaDataPlus.Configurator.MetaInstaller.LoadMetaClassVersion10(MetaDataContext context, XmlNode xmlMetaClass, MetaClass parent) +663
   Mediachase.MetaDataPlus.Configurator.MetaInstaller.RestoreFromVersion10(MetaDataContext context, XmlNode root) +566
   Mediachase.MetaDataPlus.Configurator.MetaInstaller.Restore(MetaDataContext context, XmlNode root) +175
   Mediachase.Commerce.Catalog.CatalogConfiguration.ConfigureMetaData() +118
   Mediachase.Commerce.Catalog.DefaultCatalogMetaDataModule.ConfigureMetaData() +67
   Mediachase.Commerce.Catalog.DefaultCatalogMetaDataModule.EnsureDefaultMetaData() +82
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +58
   EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +248

[InitializationException: Initialize action failed for Initialize on class Mediachase.Commerce.Initialization.CatalogInitialization, Mediachase.Commerce, Version=12.1.0.0, Culture=neutral, PublicKeyToken=6e58b501b34abce3]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +774
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +194
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +876
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +225
   EPiServer.Global..ctor() +103
   GMGShop.Web.Global..ctor() +37
   ASP.global_asax..ctor() +42

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +139
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1431
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +184
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +306
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714


[Pasting files is not allowed]

#192289
May 14, 2018 18:29
Vote:
 

I moved the thread to Commerce sub forum where it's more relevant.

I found your error is very strange. If you look into 9.0.0.0.sql in EPiServer.Commerce.Core package, there is this line

ALTER TABLE [dbo].[Market]
ADD [PricesIncludeTax] BIT DEFAULT 0 NOT NULL;

so the column can't be null and the default value is 0. I would suggest you to look into Market table to make sure everything is correct

#192291
May 14, 2018 20:19
* 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.