Developer forum

Forum » Development » Templatetags throw nullreference exception from module (Dynamicweb.Frontend.Content)

Templatetags throw nullreference exception from module (Dynamicweb.Frontend.Content)

Frederik Rossen
Frederik Rossen
Reply

Hi,

We have a project where attempting to use TemplateTags() to display all available templatetags gives us an error in the frontend: 

An error occurred while attaching module (Dynamicweb.Frontend.Content)

 

System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.Products.ProductService.ReFactorProductList(ICollection`1 products, Currency currency, Country country, StockLocation stockLocation, User user, Boolean useAssortments)
   at Dynamicweb.Ecommerce.Products.ProductService.GetRelatedCountFrontend(Product product, Currency currency, Country country, StockLocation stockLocation, User user)
   at Dynamicweb.Ecommerce.Frontend.Renderer.GetRelatedCount(Product product, Boolean isFrontend, RenderingContext renderingContext)
   at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, Template template, Int32 loopCounter, Boolean renderRelated, String productUrl, Int32 quantity, Int32 wishListId, Boolean renderPublicList, Boolean isRecursiveCall, Lazy`1 categoryFieldSorting, Int32 orderLineOfProductCount, RenderingContext renderingContext, String unitId)
   at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProducts(ProductCollection products, Template parentTemplate, String loopName, Int32 loopCounter, Boolean renderRelatedProducts, Boolean renderRelatedLists, Boolean isRecursive, RenderingContext renderingContext)
   at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProductRelatedGroups(RenderingContext renderingContext, Product product, Template parentTemplate, String loopName)
   at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, Template template, Int32 loopCounter, Boolean renderRelated, String productUrl, Int32 quantity, Int32 wishListId, Boolean renderPublicList, Boolean isRecursiveCall, Lazy`1 categoryFieldSorting, Int32 orderLineOfProductCount, RenderingContext renderingContext, String unitId)
   at Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, String unitId)
   at Dynamicweb.Ecommerce.Frontend.Frontend.EcomRender()
   at Dynamicweb.Ecommerce.Frontend.Frontend.GetContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)

It's running on DW 9.10 and Rapido 3.4.2. The issue has been present for 6+ months (since before I joined the project)

 

We can't seem to fix it ourselves and was wondering if anyone else has encountered this before, and what the fix might be?

 

Sincerely, 

Frederik Rossen


Replies

 
Frederik Rossen
Frederik Rossen
Reply

Update just in case someone stumbles over this at some point: 

 

One of our external consultants helped with the problem and it seems to be a problem with related products possibly having references to products that doesn't exist. Once we cleaned them up, the error disappeared.

 
Mikkel Hornbech Nielsen
Reply

Any fixes regarding this issue DW?

 
Nicolai Pedersen
Reply

Hi Mikkel

Depends... This issue was related to bad data. Can you show us your stack?

 

You must be logged in to post in the forum