Developer forum

Forum » Ecommerce - Standard features » StackOverflowException in ProductTemplateExtender using API Functions

StackOverflowException in ProductTemplateExtender using API Functions

Martijn Bokhove
Reply

Hi

 

Recently we have upgraded our project to version 8.2.3.2.

Running it on a testenvironment caused no problems, running it on a live environment caused the IIS to drop en restart after the application after a couple of minutes each time.

 

Now I'm running this solution on my local machine, with version 8.2.3.7.

Debugging it local shows out there are some issues with the API and the ProductTemplateExtender.

Calling the following functions inside a ProductTemplateExtender are throwing a StackOverflowException:

-    PageView.Current().Area.Value("Areaname")

-    Dim RangeProducts As ProductCollection = New ProductCollection()

    RangeProducts.Load(query)

 

Anybody any idea what could be causing this? And how to solve it?

 

Gr

Martijn


Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

Hi Martijn,

 

If you are using the Dynamicweb.eCommerce.Frontend.Renderer inside your template extender to render a collection of related products then you might have a problem with infinite recursive calls to the template extender. If that is the case then you should be able to replace your template extender with a class that inherits from Dynamicweb.Extensibility.Provider.RelatedProductListProvider

 

[RelatedProductList("MyRelatedProductsTemplateLoopName")]
public class MyRelatedProducts : RelatedProductListProvider
{
    public override ProductCollection GetCollection(RelatedProductListProviderEventArgs eventArgs)
    {
       // Load and return the collection of products
    }
}

 

/Morten

 

Votes for this answer: 1
 
Martijn Bokhove
Reply

Hi Morten

 

Yes indeed, that seems to be the reason.

Moved them to a class as you suggested and that works!

 

Thanks for your support!

 

Gr

Martijn

 

You must be logged in to post in the forum