6

So, I upgraded a Sitecore solution from 7.2 to 8.2. All works well, except for the site. I keep on getting the error in my views like the one below:

The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'Web.ViewModels.XXXViewModel'.

I did update all my Glass Cast references to sitecoreService.Cast<>(). But still no luck. Did anyone run into this issue?

We are using Glass Mapper (Version 4.2.1.188).

5
  • I had same problem when I forgot to publish datasource. Try republish everything.
    – Marek Musielak
    Commented Oct 19, 2016 at 21:10
  • 3
    I don't think Glass is resolving, can you make sure all your glass configs are being loaded via showconfig?
    – ASura
    Commented Oct 19, 2016 at 21:12
  • @ASURA That did it. Glass was not installed correctly on my Models project. The site is now working.
    – Hetal Dave
    Commented Oct 19, 2016 at 22:40
  • Glad that worked!
    – ASura
    Commented Oct 20, 2016 at 0:38
  • 1
    @ASURA Please consider converting your comment to an answer. Commented Oct 20, 2016 at 6:25

2 Answers 2

3

Hetal, I am just going to add it as an answer for potential users to benefit from.

It could be one of the following:

  1. Glass not being installed/configured properly (Glass DLL's or configs missing or are of previous versions)
  2. The Datasource item is not published (mentioned by Marek)

In your case it was Glass not properly installed in the Models project.

Thanks.

0

After un- and re-installing the newest versions of Glass.Mapper.Sc & Glass.Mapper.Sc.Core package and removing all older versions & configs it worked for me. Watch out for any custom code or configs not getting lost in the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.