Issue with VariationContent after upgrading from EPiServer.Commerce 8.16.1 to 9.24.1

Member since: 2011

Hi,

After upgrading from EPiServer.Commerce 8.16.1 to 9.24.1 I have problems related to VariationContent which results in the following error "value is a System.Double but should be a System.Int32 Parameter name: value"

From the stack trace I can see that the error occurs in Mediachase.MetaDataPlus.Configurator.MetaDataTypes.GetDatabaseValueInteger(Object value) from EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.GenerateFields(CatalogContentBase content, Int32 objectId, MetaClass metaClass, MetaDataContext context)
 

Unfortunately it doesnt say anyting about which field/property causing this or the value of the field/property. 

Seems this has been improved in version 10 (http://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=COM-4607) but doesnt help me now.

I follow the plan by starting with upgrading from version 8 to 9 making this work before continuing to version 10 and onwards to 11.

http://world.episerver.com/documentation/upgrading/episerver-commerce/9/ 

http://vimvq1987.com/2016/04/upgrade-website-commerce-9/

 

First time I encountered this issue was in the migration step "Migrates most used draft: ready to publish, checked in, checked out and rejected draft.." when doing "Migrating 'CheckedOut' drafts".

To continue the migration steps I added DisableVersionSync = true. 

Afterwards going to Episerver CMS Admin and running "Draft store migration job" (DisableVersionSync = false) resulted in the same error:

Exception: System.ArgumentException

Message: value is a System.Double but should be a System.Int32
Parameter name: value

StackTrace:    at Mediachase.MetaDataPlus.Configurator.MetaDataTypes.GetDatabaseValueInteger(Object value)
   at EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.GenerateFields(CatalogContentBase content, Int32 objectId, MetaClass metaClass, MetaDataContext context)
   at EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.UpdateContentVersion(IList`1 contents, DataTable workIdMapping, Boolean publishAction)
   at EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.ImportVersion(IList`1 contents, IList`1 commonDraftWorkIds)
   at EPiServer.Commerce.Internal.Migration.DraftStoreMigrator.Migrate(VersionStatus status, Int32& total)
   at EPiServer.Commerce.Internal.Migration.ScheduledJobs.DraftStoreMigrationJob.DoMigrate(Object stateInfo)

I see the same error when trying to open an existing "product variant" in Commerce catalog or when creating a new one when pressing publish.

ArgumentException: value is a System.Double but should be a System.Int32
 Parameter name: value
Mediachase.MetaDataPlus.Configurator.MetaDataTypes.GetDatabaseValueInteger(Object value)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.GenerateFields(CatalogContentBase content, Int32 objectId, MetaClass metaClass, MetaDataContext context)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.UpdateContentVersion(IList`1 contents, DataTable workIdMapping, Boolean publishAction)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.CreateContentVersion(CatalogContentBase content, String currentUser, Boolean publishAction, Boolean skipSetCommonDraft)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.EnsureVersionLanguages(IList`1 versionList, ContentReference contentLink)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.List(ContentReference contentLink)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.List(ContentReference contentLink, String languageBranch)
EPiServer.Commerce.Catalog.Provider.CatalogContentVersionStore.LoadCommonDraft(ContentReference contentLink, String language)
EPiServer.Cms.Shell.UI.Rest.CmsContentContextResolver.GetCommonDraft(ContentReference contentReference, String language, ContentLanguageInformation& languageInformation)
EPiServer.Cms.Shell.UI.Rest.CmsContentContextResolver.TryResolveUri(Uri uri, ClientContextBase& instance)
EPiServer.Shell.UI.Rest.ContextStore.ResolveUri(Uri uri)lambda_method(Closure , ControllerBase , Object[] )

I have also tried creating a new "product variant" inheriting from EPiServer.Commerce.Catalog.ContentTypes.VariationContent but no other properties.

[CatalogContentType(GUID = "D8B8A6EB-1DBB-47FE-9C9C-E3D9312AACC9", MetaClassName = "VariationTestClass")]
    [AvailableContentTypes(Availability = Availability.None)]
    public class ProductVariantTest : EPiServer.Commerce.Catalog.ContentTypes.VariationContent
    {
    }

Samme issue. Not being able to publish the "product variant" as it results in an error "value is a System.Double but should be a System.Int32 Parameter name: value"

Any ideas what causing this or any recommendations going forward?

//packages

<package id="EPiServer.CMS" version="9.12.2" targetFramework="net452" />
<package id="EPiServer.CMS.Core" version="9.12.4" targetFramework="net452" />
<package id="EPiServer.CMS.UI" version="9.9.2" targetFramework="net452" />
<package id="EPiServer.CMS.UI.Core" version="9.9.2" targetFramework="net452" />
<package id="EPiServer.Commerce" version="9.24.1" targetFramework="net452" />
<package id="EPiServer.Commerce.Core" version="9.24.1" targetFramework="net452" />
<package id="EPiServer.Commerce.FindSearchProvider" version="8.13.2" targetFramework="net452" />
<package id="EPiServer.Commerce.UI" version="9.24.1" targetFramework="net452" />
<package id="EPiServer.Commerce.UI.ManagerIntegration" version="9.24.1" targetFramework="net452" />
<package id="EPiServer.Find" version="12.0.0.4448" targetFramework="net452" />
<package id="EPiServer.Find.Cms" version="12.0.0.4448" targetFramework="net452" />
<package id="EPiServer.Find.Framework" version="12.0.0.4448" targetFramework="net452" />
<package id="EPiServer.Framework" version="9.12.4" targetFramework="net452" />

#181107 Aug 09, 2017 9:28
  • Member since: 2011

    So String01 column is null (for those rows)? That's very strange and you might have a faulty database... 

    #181232 Aug 14, 2017 15:45
  • Member since: 2011

    Nope. Generally it has the values "Product", "Variation" or "Bundle". 421 rows have a null value in String01 column.

    Using GetContent() method/Content property on CatalogContentDraft mentioned in my previous comment I get the following error:

    System.NullReferenceException

    Object reference not set to an instance of an object

       at EPiServer.Core.Transfer.Internal.ContentNameTransform.ShouldValidateUniqueness(TransformPropertyEventArgs eventArgs, IContentTransferContext context)
       at EPiServer.Core.Transfer.Internal.ContentNameTransform.ImportEventHandler(Object sender, TransformPropertyEventArgs e)
       at EPiServer.Enterprise.ImportingPropertyEventHandler.Invoke(ITransferContext transferContext, TransformPropertyEventArgs e)
       at EPiServer.Core.Transfer.Internal.DefaultPropertyImporter.ImportProperty(RawContent rawContent, IContent content, RawProperty importedProp, PropertyData propDestination, IContentTransferContext context, TransferImportOptions options)
       at EPiServer.Core.Transfer.Internal.ContentInterfaceImport.ImportProperty(IPropertyImporter currentTranfer, RawContent rawContent, IContent content, RawProperty importedProperty, IContentTransferContext context, TransferImportOptions options)
       at EPiServer.Core.Transfer.Internal.DefaultPropertyImporter.ImportProperties(IContent newContent, RawContent importedContent, IContentTransferContext context, TransferImportOptions options)
       at EPiServer.Commerce.Catalog.Provider.CatalogContentDraft.ConstructContent(ContentReference contentLink, ContentReference parentLink, String language, String masterLanguage, Byte[] serializedRawContent, String baseEntryType, Int32 metaClassId, Nullable`1 catalogId, String routeSegment, VersionStatus status, Nullable`1 startPublish, Guid contentGuid, String name, String existingLanguages)
       at EPiServer.Commerce.Catalog.Provider.CatalogContentDraft.ReconstructContent(ContentReference parentLink)
       at EPiServer.Commerce.Catalog.Provider.CatalogContentDraft.GetContent(ContentReference parentLink)

    #181235 Edited, Aug 14, 2017 15:53
  • Member since: 2011

    How's about other String columns? Are there nothing on those?

     I would suggest you to contact Episerver support service. Getting a hand on your database would help to resolve this issue in matter of hours, or even minutes :) 

    #181242 Aug 14, 2017 16:12
  • Member since: 2011

    In the 421 rows as mentioned before the reason why String01 column ha a null value is because it is a previous published version of "NodeContent".

    All rows which have  String01 column with values "Product", "Variation" or "Bundle" do also have data in the other StringXX columns.

    String02 = ;;no;;da;;de;;nl;;sv;; so must be existing languages

    String03 = Current langauge branch

    String04 = master language branch

    String05 = Name

    String06 = NULL value

    String07 = Name in URL

    String08,09,10 are all NULL value

    In Commerce 8 version of the site versioning works fine. I can see the previous published version in the Catalog UI. 

    The same goes for Commerce 9 where I'm able to see those few that have been migrated from Commerce 8 structure to Commerce 9 structure when running the scheduled job "Draft store migration job".

    contact Episerver support service: OK.

    #181243 Aug 14, 2017 16:30
  • Member since: 2011

    Found the problem. Problem not in the data in DDS store CatalogContentDraft but in the MetaField table. The MetaField "Weight" shouldn't be there at all. 

    Looked thorugh commit history and found that we have had an "Weight" property (public virtual int Weight { get; set; }) ealier in the site (added back in 2014 and removed again). This has caused that this metafield were created but when the metafield got removed it appenrently didn't get deleted from the MetaField table :/

    Why the "Draft store migration job" uses this metafield when running the migration I don't understand as the "Weight" metafield don't have any relation to the catalog content.

    After I deleted the metafield in the MetaField table and re-ran the job it was successful: "Migrated 40723 PreviouslyPublished drafts."

    #181246 Edited, Aug 14, 2017 17:46
First   1 2   Last