I just "upgraded" to the Umbraco.ModelsBuilder community package.
Properties generated by Umbraco.ModelsBuilder.Embedded have the following GeneratedCodeAttribute:
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.5.4")]
public new const string ModelTypeAlias = "File";
Properties Generated by Umbraco.ModelsBuilderhave this:
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.0")]
public new const string ModelTypeAlias = "File";
Shouldn't Umbraco.ModelsBuilder.Embedded's attributes be changed to reflect the change? i.e.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "8.5.4")]
public new const string ModelTypeAlias = "File";
I have no idea, I'll get back to you.
Seems like a simple oversight, as the attribute should indeed reflect the correct tool that generated the code: https://docs.microsoft.com/en-us/dotnet/api/system.codedom.compiler.generatedcodeattribute.-ctor?view=netframework-4.7.2#System_CodeDom_Compiler_GeneratedCodeAttribute__ctor_System_String_System_String_
Will it break anything to update to the new name? I don't really know how the name is being used, I am not familiar with this attribute and it's implications.
The Umbraco codebase doesn't use it (besides generating it in Umbraco.ModelsBuilder.Embedded.Building.TextBuilder and testing the output in Umbraco.Tests.ModelsBuilder.BuilderTests), as it's more a marker attribute for code analysis tools and IDEs...
The comments above the WriteGeneratedCodeAttribute method also clearly state why it's added:
https://github.com/umbraco/Umbraco-CMS/blob/ad53b7630837de8db7bc7871dacea9af2a51e4f4/src/Umbraco.ModelsBuilder.Embedded/Building/TextBuilder.cs#L86-L98
Awesome, thanks for the investigation! Seems safe to rename then. 馃憤
Hi @JasonElkin,
We're writing to let you know that we've added the Up For Grabs label to your issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.
For more information about issues and states, have a look at this blog post
Thanks muchly, from your friendly PR team bot :-)
I think this change is causing issues when migrating an Umbraco 8.6.x website to Umbraco 8.7.1
After migration it looks like things work, but after regenerating the model (mode LiveAppData) I notice that
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.6.6")]
becomes
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "8.6.6")]
In the backend you can see the content but on the frontend everythings break and it can't read any of the properties anymore. Looks that resaving every single item in the backend seems to work (not sure long term) and my sites as hunderts of pages so not really an option for a go live to have the site offline for a day or so.
Is there any fix to undo this renaming of the namespace ?
Hi @onlinegroeicoach,
This almost certainly isn't the cause of the problem you're having.
Looks that resaving every single item in the backend seems to work
Would imply to me that something else is not quite right after the upgrade.
The GeneratedCodeAttribute is just there to say _where_ this code came from so that we devs and code analysis tooling can find out where the code came from. Since Umbraco 8.5 the models have come from a different place and this change was made simply to reflect that fact.
In the backend you can see the content but on the frontend everythings break and it can't read any of the properties anymore.
Like @JasonElkin commented above, this issue isn't the cause... It's almost certainly an issue with a corrupt NuCache (I've seen this quite a few times), which can be fixed by going to 'Settings - Published Status' and doing: