Stange issue in theme views

Topics: Writing themes
Oct 13, 2011 at 12:17 PM

I have a strange issue within a view of a theme.

I have a content type "product". On the detail page, often after updating the product in the admin, the view generates an error upon viewing the product. (see below)

  • The view uses a helper function defined in the razor file itsself -> "@functions{}"
  • When i get the error, all I need to to is "resave" the view and the error is gone upon reloading... (adding a space and saving the cshtml file is enough)

Strange problem I know :) Anyone an idea?


The error:

Line 56: <h1>@Model.Title</h1>Line 57: @Html.Raw(Model.ContentItem.BodyPart.Text)Line 58: @if (!(hasBags(Model.ContentItem.Product) != true

Index was outside the bounds of the array. 

Oct 13, 2011 at 12:17 PM

By the way, I'm on version 1.3, but had the problem before as well...

Oct 13, 2011 at 8:04 PM

Nope, no clue. Do you have a full stack trace of that?

Oct 14, 2011 at 8:02 AM

No I don't.

I just tried to reproduce the error but I don't find the thing that triggers the error. It always happens after a product update, but not always it seems. (often though)

I'll keep an eye on it and come back on it with a stack trace :)