Try our conversational search powered by Generative AI!

FindCommerce StackOverflow exception when editing price

Found in

EPiServer.Find.Commerce 9.5.0

Fixed in

EPiServer.Find.Commerce 9.5.1

(Or a related package)

Created

Mar 23, 2016

Updated

Apr 01, 2016

Area

Find

State

Closed, Fixed and tested


Description

This code causes a StackOverflow exception when the price is edited.

        protected virtual void ApplyPricingConventions(
            TypeConventionBuilder<IPricing> conventionBuilder)
        {
            conventionBuilder
                .ExcludeField(c => c.PriceReference)
                .ExcludeField(x => x.DefaultPrice())
                .ExcludeField(x => x.Prices());
        }

Steps to reproduce:

Add class like this to the project.

[ServiceConfiguration(ServiceType = typeof(CatalogContentClientConventions))]
public class IndexingConfiguration : CatalogContentClientConventions
    {
        public override void ApplyConventions(IClientConventions conventions)
        {
            ApplyPricingConventions(conventions.ForInstancesOf<IPricing>());
        }
 
        /// <summary>
        /// Prices are indexed for variations by default. The prices will be part of the variation document,
        /// and will contain information about the all prices for different users and groups.
        /// When a price event is trigged, the variation content will be reindexed.
        /// By removing the prices, and default price from the variation, the content will not be reindexed on price updates.
        /// </summary>
        /// <param name="conventionBuilder"></param>
        protected override void ApplyPricingConventions(EPiServer.Find.ClientConventions.TypeConventionBuilder<IPricing> conventionBuilder)
        {
            base.ApplyPricingConventions(conventionBuilder);
            conventionBuilder
                .ExcludeField(x => x.DefaultPrice())
                .ExcludeField(x => x.Prices());
        }
}

Then build and try to edit a price.