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

Compilation of source with auto-generated version is non-deterministic #4578

Closed
tmat opened this issue Aug 15, 2015 · 9 comments
Closed

Compilation of source with auto-generated version is non-deterministic #4578

tmat opened this issue Aug 15, 2015 · 9 comments
Assignees
Labels
2 - Ready Area-Compilers Bug Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time.
Milestone

Comments

@tmat
Copy link
Member

tmat commented Aug 15, 2015

[assembly: System.Reflection.AssemblyVersion("1.0.*")]

The compiler generates the version based on the current time:

// src\Compilers\Core\Portable\VersionHelper.cs:
...
            if (hasWildcard)
            {
                int seconds = ((int)(DateTime.Now.TimeOfDay.TotalSeconds)) / 2;
                if (seconds > (int)maxValue)
                {
                    version = null;
                    return false;
                }
                values[3] = (ushort)seconds;

                if (elements.Length == 3)
                {
                    TimeSpan days = DateTime.Today - new DateTime(2000, 1, 1);
...
@tmat tmat added Bug Area-Compilers Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. labels Aug 15, 2015
@tmat
Copy link
Member Author

tmat commented Aug 15, 2015

@gafter Not sure what we can do about this, other then report an error that it's not supported in deterministic builds.

@tmat
Copy link
Member Author

tmat commented Aug 15, 2015

@gafter See also #4580. I propose deprecating this feature -- auto-generated version.

@gafter gafter added this to the 1.1 milestone Aug 15, 2015
@gafter
Copy link
Member

gafter commented Aug 15, 2015

See also #4575.

@gafter
Copy link
Member

gafter commented Aug 16, 2015

@tmat Yes, I agree. Probably the way to deprecate it is to produce a warning whenever the feature is used, but continue to support it?

@gafter
Copy link
Member

gafter commented Sep 16, 2015

Our conclusion is that we want to report a diagnostic (not sure warning or error) when this feature is used along with /feature:deterministic.

@gafter gafter assigned TyOverby and unassigned gafter Sep 16, 2015
@TyOverby
Copy link
Contributor

The only time we have allowWildcard: true is on line 2076 of SourceAssemblySymbol.cs. Would it be sufficient to check right there and see if we are running in "deterministic mode"?

@gafter
Copy link
Member

gafter commented Sep 20, 2015

@TyOverby I think we want to allow a wildcard but produce a warning in deterministic mode.

@tmat
Copy link
Member Author

tmat commented Sep 21, 2015

@gafter Why not just report an error? It's not gonna work as user expects, so to avoid confusion it seems better to report an error.

@gafter
Copy link
Member

gafter commented Sep 21, 2015

@tmat sounds good to me. So to @TyOverby's question, we could probably just change allowWildcard: true to something like allowWildcard: !deterministicMode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - Ready Area-Compilers Bug Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time.
Projects
None yet
Development

No branches or pull requests

3 participants