-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModelsBuilder generated files use scientific notation for version number #15597
Comments
Hi there @tormnator! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Another question is whether that attribute needs to be there, or if it does, if the version parameter needs to be there. Having it there causes the generated files to frequently be modified (i.e. whenever Umbraco is updated), requiring a new check-in into the version control repository. One might say that the generated files shouldn't be in the repository in the first place, but for Umbraco Cloud I don't think there's a way around including them. Or? |
Hi @tormnator 👋 You are right, you need to commit them into the git repository for each Umbraco Cloud environment. So, changing the version number to just "12.3.6" for example, seems like a good idea. I will mark this as up for grabs if anyone is up for it 🙂 |
Hi @tormnator, We're writing to let you know that we would love some help with this 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 Umbraco GitHub bot :-) |
@elit0451 do we need the version number at all? They are quite annoying, and as @tormnator mentions, cumbersome to work with, as every upgrade changes all model files. |
Looks like it should be an easy fix to remove the scientific notation part. The method to change is https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Infrastructure/ModelsBuilder/Building/TextBuilder.cs#L146. There are also source code xml comments with references (url's) which could be helpful in determining if it's possible to reduce or remove the version number. |
Upon further review, that suffix is not a number in scientific notation, but the build number, i.e. major.minor.patch.build. It looks like it's taken from the current executing assembly, which must be Umbraco.Infrastructure.dll. Also, after googling around and asking ChatGPT, I can't find any references to tools or other consumers actually using the Version property, and assume it's only there for informational purposes. The documentation states this property is the version of the tool which generated the code. Since the tool name is hardcoded as "Umbraco.ModelsBuilder.Embedded", maybe we could solve this by also hardcoding the version number. At least it seems slightly inaccurate to use the assembly's version number. To summarize, for me the grievance is that the presence of the full version number in the attribute causes the generated files to too often show up as changed and in need of commit in my local repo for Umbraco cloud. If the version number was more stable, the generated files would only show up as changed when the actual generated code is changed. I assume this is core enough for the masters of Umbraco to decide before making any code changes/PR's. |
I think is somewhat normal/standard to include the assembly name and version in auto-generated. Microsoft does something similar for some of their tools. But I can see why it might not make so much sense in this context, so could make sense to make a away to disable that. On the other hand, one could argue that it's nice to have the version included - eg. to better debug any issues that might occur. Anyways, the part after the |
Just to chip in: indeed I asked for some insights as to what the version was for from the original developer Stephane as well: https://hachyderm.io/@zpqrtbnk/111844477726539958 What problem are we really trying to solve here? What about the SHA bothers you so that it needs to be removed? |
Every time Umbraco upgrades (both minors and patches), all model files changes, but they only change the version number. This is quite annoying, as you then have to decide if you want to include all those changes in your Pull Request, even if they don't actually do any changes. Example
If the number is not important, or anything, I would love if it was removed. I have the same issue with Deploys .uda files. |
Okay, original issue was about the SHA though! I understand the version number is slightly annoying. Looks like Make sure to create an issue on the Deploy issue tracker if you want them to consider removing the version number. |
I would like to report the same thing. Over 130 models have changed because of the version code |
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
12.3.6
Bug summary
The release part of the version parameter on the GeneratedCodeAttribute is written in scientific notation, e.g. "12.3.6+e8a81e3" when "12.3.6" would be sufficient.
Specifics
No response
Steps to reproduce
I use the following settings in appSettings.json:
Build, run and open the site's back office. Then go to the Models Builder tab under Settings and click "Generate Models".
Expected result / actual result
The expected version number would be something like "12.3.6", but in my case the generated files actually look like this:
The text was updated successfully, but these errors were encountered: