Skip to content
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

Determinism end-user experience is poor #26231

Open
IanKemp opened this issue Apr 18, 2018 · 8 comments
Open

Determinism end-user experience is poor #26231

IanKemp opened this issue Apr 18, 2018 · 8 comments
Assignees
Labels
Area-Compilers Bug Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Milestone

Comments

@IanKemp
Copy link
Contributor

IanKemp commented Apr 18, 2018

I created a new .NET Standard 2.0 class library in Visual Studio 2017 (15.6.6) this morning and set the Assembly Version to 1.0.*. Upon build, I was confronted with the error message:

The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation

Cue research into what the heck determinism means in the context of C# compilation, leading me to know that I do, in fact, want it disabled for my use case. Cue more research into how to disable it, which finally lead me to this answer on Stack Overflow. Not very discoverable!

I see that #22660 and #22973 somewhat addressed this issue by making the error more explicit, but in my opinion it's still not useful or helpful enough:

This is compounded by the fact that there doesn't seem to be a Microsoft documentation page explaining how to control determinism from the command-line or in a .csproj. The closest I have found is this.

tl;dr this is all a bit of a mess and it's definitely not a great experience for someone who is dipping their toe in .NET Standard. Suggestions to make things better:

  • Add a checkbox for determinism to the Visual Studio "Project Properties" UI for .NET Standard projects to allow the user to control this setting (I appreciate this is probably not the appropriate repo to make this request, please advise where I should open a ticket if not)
  • Create an official documentation page discussing what determinism is and how to enable or disable it from the command-line (MSBuild and csc) and in a csproj (via Visual Studio UI and manually editing)
  • Update the error message to link to the aforementioned page
@sharwell
Copy link
Member

sharwell commented Apr 18, 2018

This is a great report covering the complete user experience. Thanks for taking the time to report the details of the various pain points you hit!

leading me to know that I do, in fact, want it disabled for my use case

My biggest initial concern is the documentation led someone to this conclusion.

@sharwell sharwell added Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. labels Apr 18, 2018
@IanKemp
Copy link
Contributor Author

IanKemp commented Apr 18, 2018

@sharwell from the linked SO answer:

However if you are using TeamCity, TFS or other CI/CD tool, it's probably better to keep the version number controlled and incremented by them and pass to build as a parameter

which is exactly my scenario. I would very much like to enable determinism, but right now it's not an option.

Regarding documentation, @jaredpar's blog post is pretty complete, but obviously in no way official.

@sharwell
Copy link
Member

@IanKemp I believe you misread the SO answer. When you pass those two properties to the build, it will generate an assembly info file containing the values from it. Here is an example of the properties specified in a manually-incremented file (AssemblyVersion defaults to the value of Version if not specified separately):

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/f01be7a8262f146766af90138530ee0f21ddfba1/StyleCop.Analyzers/Directory.Build.props#L11-L13

When using these properties, you do not want wildcard versioning, which means determinism can be enabled.

@IanKemp
Copy link
Contributor Author

IanKemp commented Apr 19, 2018

@sharwell Thank you - this is what happens when I am sick... and when there isn't appropriate documentation. (Insert sound of dead horse beating.)

So then I guess the only remaining question is: why would you ever want to use * in the *Version properties, and is it worth updating the documentation and whatnot to handle that case in a nicer manner?

@sharwell
Copy link
Member

sharwell commented Apr 19, 2018

why would you ever want to use * in the *Version properties

Aside from backwards compatibility (avoiding breaking projects that used it in the past), I am not aware of any reason.

@jaredpar jaredpar self-assigned this Aug 30, 2018
@jaredpar jaredpar added this to the 16.0 milestone Aug 30, 2018
@jaredpar jaredpar added the Bug label Aug 30, 2018
@jinujoseph jinujoseph modified the milestones: 16.0, 16.3 Jun 9, 2019
@jcouv jcouv modified the milestones: 16.3, Compiler.Next Jul 11, 2019
@maxima120
Copy link

it has to be in the project properties UI.. whatever reason for using it or not using it..

@BoCoKeith
Copy link

Two thumbs up for adding a determinism checkbox to the project properties. Having to add a tags to the project file to enable auto-versioning is just not right.

At the least: how about adding a comment in the Assembly.cs templates that tells you what to do if you want to enable auto-versioning. Simple fix, no code change, less confusion.

@jaredpar jaredpar modified the milestones: Compiler.Next, Backlog Sep 12, 2023
@tmat
Copy link
Member

tmat commented May 16, 2024

Some doc improvements: dotnet/dotnet-api-docs#9892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings.
Projects
None yet
Development

No branches or pull requests

8 participants