Adding a new property to a document type breaks LINQ to Umbraco
I have an existing document type and page nodes using that document type.
I add a new property to the document type.
I export my document types with "Export to .NET"
I update the DataContext file and rebuild the project
I browse in to the site and it throws an exception.
Even if I "Republish entire site" the site is still broken, since neither the umbraco.config or the table cmsContentXml in the database and probably not the memory cache gets updated with the new property.
I have to go in to every page that uses this document type and press save and publish.
Is this a known issue? Are there any easy fix, maybe a package that can republish it for me?
I get the same thing as well for all properties that are not mandatory in Umbraco. Say for instance i got a DateTime field on my type, but i don't have to fill it out in Umbraco i get a conversion-error when trying to use Linq2Umbraco. If i change the type to DateTime? (nullable) i get another conversion error as well.
There seems to be missing some kind of value-checking when populating data. Like if the field in Umbraco is empty and the field is not mandatory, well, just ignore it then... it shouldn't throw an error. The same case if the field wasn't found at all, which is the case when adding new properties after nodes are created....
I also get an error, but mine is different. I'm using Linq to Umbraco with my own NodeDataProvider which i pass a custom path to the XML file in. It works when there are no properties added to a doc type, but as soon as there are properties i get this exception
[NullReferenceException: Object reference not set to an instance of an object.] umbraco.BusinessLogic.User.setupUser(Int32 ID) +201 umbraco.BusinessLogic.User..ctor(Int32 ID) +238 umbraco.UmbracoSettings.ensureSettingsDocument() +773 umbraco.UmbracoSettings.GetKey(String Key) +61 umbraco.UmbracoSettings.get_ForceSafeAliases() +69 umbraco.cms.helpers.Casing.SafeAliasWithForcingCheck(String alias) +49 umbraco.Linq.Core.Node.NodeDataProvider.LoadFromXml(XElement xml, T node) +2836 umbraco.Linq.Core.Node.NodeTree`1.GetEnumerator() +1057 ASP.views_site_latestmediaentries_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\~FARMPROJECTS\WMA0007 - Linkin Park\branches\v1.0-MAINLINE\LinkinPark.v2\LinkinPark.Web\Views\Site\LatestMediaEntries.ascx:6 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +245 System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +84 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5273
I've added a change so that if the node hasn't been republished you wont have an exception thrown on new properties, they'll just be set to null, this matches what NodeFactory.Node works.
Adding a new property to a document type breaks LINQ to Umbraco
Even if I "Republish entire site" the site is still broken, since neither the umbraco.config or the table cmsContentXml in the database and probably not the memory cache gets updated with the new property.
I have to go in to every page that uses this document type and press save and publish.
Is this a known issue? Are there any easy fix, maybe a package that can republish it for me?
I get the same thing as well for all properties that are not mandatory in Umbraco. Say for instance i got a DateTime field on my type, but i don't have to fill it out in Umbraco i get a conversion-error when trying to use Linq2Umbraco. If i change the type to DateTime? (nullable) i get another conversion error as well.
There seems to be missing some kind of value-checking when populating data. Like if the field in Umbraco is empty and the field is not mandatory, well, just ignore it then... it shouldn't throw an error. The same case if the field wasn't found at all, which is the case when adding new properties after nodes are created....
Posting error messages makes it easier to try and solve the problem
Posting answer or comment makes it easier to try and solve the problem
Pauli, the comment posted by Daniel Eriksson is the same stack trace I got when I added a new property.
I also get an error, but mine is different. I'm using Linq to Umbraco with my own NodeDataProvider which i pass a custom path to the XML file in. It works when there are no properties added to a doc type, but as soon as there are properties i get this exception
Are you overriding NodeDataProvider or UmbracoDataProvider?
If you're using your own custom XML document then you should override UmbracoDataProvider
I've added a change so that if the node hasn't been republished you wont have an exception thrown on new properties, they'll just be set to null, this matches what NodeFactory.Node works.
Great!
is working on a reply...