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

Confusing error message for wildcard in [AssemblyVersion] on .Net Core #22660

Closed
svick opened this issue Oct 11, 2017 · 3 comments
Closed

Confusing error message for wildcard in [AssemblyVersion] on .Net Core #22660

svick opened this issue Oct 11, 2017 · 3 comments
Assignees
Labels
Area-Compilers 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. Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@svick
Copy link
Contributor

svick commented Oct 11, 2017

Version Used: .Net Core 2.0.0

Steps to Reproduce:

  1. Create the following .Net Core 2.0 application:

    csproj:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp2.0</TargetFramework>
        <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
      </PropertyGroup>
    </Project>

    Program.cs:

    using System;
    using System.Reflection;
    
    [assembly: AssemblyVersion("1.0.*")]
    
    class Program
    {
        static void Main()
        {
            Console.WriteLine(typeof(Program).Assembly.GetName().Version);
        }
    }
  2. dotnet build

Actual Behavior: dotnet build produces a confusing error message:

Program.cs(4,28): error CS7034: The specified version string does not conform to the required format - major[.minor[.build[.revision]]]

Expected Behavior: The error clearly explains that the actual problem is that wildcard assembly versions are not allowed for deterministic builds.

Adding <Deterministic>False</Deterministic> to the csproj indeed makes the code compile.


The question that prompted this issue: dotnet/sdk#1098 (comment).

@sharwell sharwell added Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. labels Oct 11, 2017
@rollsch
Copy link

rollsch commented Oct 13, 2017

The existing error message is quite uninformative, I would imagine using wildcards is fairly common so it would be great to see this error message detail some of the information found here.

Even more confusing in my case is I am simply using the new csproj format and targeting 461 (as I was previously) so you would not expect a change in behavior here.

+1

@michael-freidgeim-webjet

The message should also provide a link, explaining why deterministic is considered a desired setting, e.g.
http://blog.paranoidcoding.com/2016/04/05/deterministic-builds-in-roslyn.html
and Compilers should be deterministic: same inputs generate same outputs #372

@jcouv jcouv added the Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. label Nov 2, 2017
@jcouv jcouv self-assigned this Nov 2, 2017
@jcouv jcouv added this to the 15.6 milestone Nov 2, 2017
@jcouv
Copy link
Member

jcouv commented Nov 2, 2017

I agree. Queue a fix (#22973).
Thanks for the feedback.

@jcouv jcouv added the 4 - In Review A fix for the issue is submitted for review. label Nov 2, 2017
@jcouv jcouv closed this as completed Nov 3, 2017
@jcouv jcouv added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Nov 3, 2017
@gafter gafter removed 4 - In Review A fix for the issue is submitted for review. labels Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers 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. Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

6 participants