I am working with my team on the trial version of Umbraco Cloud. We're using the Igloo theme to quickly build out a sample site.
We are currently seeing the following error after an update to Umbraco.Deploy was pushed to fix an issue. We have no custom C# code of our own though.
It seems like deploying the changes to Umbraco.Deploy kicked off a new model generation and exposed an issue. I get this locally as well. Has anyone seen this type of error? I'm not really sure what to do about it.
Looking at the error message it appears your models have been generated twice in 2 different forms.
On your local instance, have a look an see if there following files exist:
Umbraco.Web.PublishedModels located in your bin directory
AllWeball.generated.cs in your app_data folder (I can't remember exactly where in the folder).
If they both exist delete them both and restart the website. The easiest way to trigger this is to modify the web.config and add a space at the end of the file and save it.
I think that should fix the issue, in that when the site restarts the models should be re-generated cleanly.
If it works locally, you should be able to repeat the process on your Umbraco Cloud instance.
We did have an Umbraco.Web.PublishedModels.dll in the bin folder in addition to the app_data\models\ generated files.
It sounds like since we are in PureLive mode, the Umbraco.Web.PublishedModels.dll in the bin folder was conflicting with the one generated in memory. Does it sound like I'm understanding that correctly?
I cleaned out the models folder and removed the dll from the bin folder, then re-generated (a few different ways, to be sure: recycled app pool, edited web.config with a space at the end, and saved an existing document type). The files in the models folder were re-generated, but now we get a new error:
Now it's saying we need to add a reference to Umbraco.Web.PublishedModels, but I'm not sure why we'd be getting that when this all worked before and we haven't edited anything code-wise out of the box.
The views web.config contains
add namespace="Umbraco.Web.PublishedModels"
I've also tried adding a using statement in the cshtml for Umbaco.Web.PublishedModels, but that didn't change anything.
I'm actually not sure why it's being called as a method, though treating it as a property throws an error saying it needs to be invoked as a method. I thought maybe it was an idiosyncrasy of how Umbraco exposes content to the Razor views.
Okay so I'm going to make some assumptions here now.
I have a theory that Settings() is a custom extension method that someone has made for you. Most likely it exists in the namespace Igloo.Extensions and is an extension method for IPublishedContent. The reason for making this assumption is, if this was not the case, then you would be getting a very different error message.
Now, the question is where is the source code for this extension method? My guess would be that this extension method is in an external library that your site is using and that library expects your site to be using DLL mode and not pure live mode. As a result when we did the clean up of the models builder conflict earlier we exposed a new issue.
It would be worth doing the following:
Change Models Builder mode to DLL instead of PureLive.
Delete the PureLive models builder file that was previously generated
Rebuild the Models
Restart the website
Test to see if this resolves the issue.
If it does fix the issue, the next thing you'll probably want to do is find the sourcecode for Igloo.Extensions (I'm affraid without seeing the site code I can't advise any pointers on that though).
You got it. There was a theme installed called Igloo. I didn't realize it depended on the models being done a certain way. So what I did was:
Remove files from app_data\models
Update Umbraco.ModelsBuilder.ModelsMode in web.config to Dll
In the backoffice under "Models Builder", clicked the "Generate models" button. This restarts the site and compiles an Umbraco.Web.PublishedModels.dll file in the bin folder.
The site now works as expected. Thank you so much for your help with this!
Question about generated models
Hello,
I am working with my team on the trial version of Umbraco Cloud. We're using the Igloo theme to quickly build out a sample site.
We are currently seeing the following error after an update to Umbraco.Deploy was pushed to fix an issue. We have no custom C# code of our own though.
It seems like deploying the changes to Umbraco.Deploy kicked off a new model generation and exposed an issue. I get this locally as well. Has anyone seen this type of error? I'm not really sure what to do about it.
Thanks, Joe
Hi Joseph,
Looking at the error message it appears your models have been generated twice in 2 different forms.
On your local instance, have a look an see if there following files exist:
If they both exist delete them both and restart the website. The easiest way to trigger this is to modify the web.config and add a space at the end of the file and save it.
I think that should fix the issue, in that when the site restarts the models should be re-generated cleanly.
If it works locally, you should be able to repeat the process on your Umbraco Cloud instance.
Nik
Thanks for this information!
We did have an Umbraco.Web.PublishedModels.dll in the bin folder in addition to the app_data\models\ generated files.
It sounds like since we are in PureLive mode, the Umbraco.Web.PublishedModels.dll in the bin folder was conflicting with the one generated in memory. Does it sound like I'm understanding that correctly?
I cleaned out the models folder and removed the dll from the bin folder, then re-generated (a few different ways, to be sure: recycled app pool, edited web.config with a space at the end, and saved an existing document type). The files in the models folder were re-generated, but now we get a new error:
Now it's saying we need to add a reference to Umbraco.Web.PublishedModels, but I'm not sure why we'd be getting that when this all worked before and we haven't edited anything code-wise out of the box.
The views web.config contains
add namespace="Umbraco.Web.PublishedModels"
I've also tried adding a using statement in the cshtml for Umbaco.Web.PublishedModels, but that didn't change anything.
Hi Joseph,
The way in which you are calling General seems a bit odd to me to be honest.
I've not seen a model with a .Settings() method on it before. Do you have code somewhere that is attempting to extend you general models?
Thanks
Nik
Settings comes from a template:
I'm actually not sure why it's being called as a method, though treating it as a property throws an error saying it needs to be invoked as a method. I thought maybe it was an idiosyncrasy of how Umbraco exposes content to the Razor views.
In your Master.cshtml file, what does the @Inherits statement look like? And can you share what your content tree looks like?
Here's the content tree:
And here's the top of the master.cshtml file.
Hi Joseph,
Okay so I'm going to make some assumptions here now.
I have a theory that
Settings()
is a custom extension method that someone has made for you. Most likely it exists in the namespaceIgloo.Extensions
and is an extension method for IPublishedContent. The reason for making this assumption is, if this was not the case, then you would be getting a very different error message.Now, the question is where is the source code for this extension method? My guess would be that this extension method is in an external library that your site is using and that library expects your site to be using DLL mode and not pure live mode. As a result when we did the clean up of the models builder conflict earlier we exposed a new issue.
It would be worth doing the following:
If it does fix the issue, the next thing you'll probably want to do is find the sourcecode for Igloo.Extensions (I'm affraid without seeing the site code I can't advise any pointers on that though).
Thanks
Nik
You got it. There was a theme installed called Igloo. I didn't realize it depended on the models being done a certain way. So what I did was:
The site now works as expected. Thank you so much for your help with this!
Joe
No problem, happy we got it sorted for you 👍
is working on a reply...