Skip to content

Incremental Csc is broken in our SDK #275

Closed

Description

@eerhardt

I know this can't be fixed wholly in the dotnet/sdk, but this SDK owns this experience, so logging here to track the full end-to-end experience.

Repro:

dotnet new -t msbuild
dotnet restore3
dotnet build3
dotnet build3

Expected results:

The 2nd build3 should be faster than the first, by a lot since nothing has changed.

Actual results:

The 2nd build3 takes the same amount of time on my machine. Doing a /v:diag produces:

Target Performance Summary:
        0 ms  CreateSatelliteAssemblies                  1 calls
        0 ms  GetFrameworkPaths                          1 calls
        0 ms  AfterCompile                               1 calls
        0 ms  ExpandSDKReferences                        1 calls
        0 ms  _SetTargetFrameworkMonikerAttribute        1 calls
        0 ms  ResolveLockFileAnalyzers                   1 calls
        0 ms  GetAssemblyVersion                         1 calls
        0 ms  Build                                      2 calls
        0 ms  GetInstalledSDKLocations                   1 calls
        0 ms  CreateCustomManifestResourceNames          1 calls
        0 ms  AfterBuild                                 1 calls
        0 ms  AfterResolveReferences                     1 calls
        0 ms  BeforeResGen                               1 calls
        0 ms  PrepareResources                           1 calls
        0 ms  ResGen                                     1 calls
        0 ms  _GenerateCompileInputs                     1 calls
        0 ms  Compile                                    1 calls
        0 ms  _GenerateSatelliteAssemblyInputs           1 calls
        0 ms  ResolvePackageDependenciesForBuild         1 calls
        0 ms  PrepareForRun                              1 calls
        0 ms  GetCopyToOutputDirectoryItems              1 calls
        0 ms  BeforeBuild                                1 calls
        0 ms  _CopySourceItemsToOutputDirectory          1 calls
        0 ms  SetWin32ManifestProperties                 1 calls
        0 ms  CoreBuild                                  1 calls
        0 ms  ResolveReferences                          1 calls
        0 ms  PrepareProjectReferences                   1 calls
        0 ms  BeforeResolveReferences                    1 calls
        0 ms  PrepareResourceNames                       1 calls
        0 ms  GetReferenceAssemblyPaths                  1 calls
        0 ms  AfterResGen                                1 calls
        0 ms  BeforeCompile                              1 calls
        0 ms  _SplitProjectReferencesByFileExistence     1 calls
        0 ms  GetTargetPath                              1 calls
        0 ms  GenerateBuildDependencyFile                1 calls
        0 ms  _SetEmbeddedWin32ManifestProperties        1 calls
        1 ms  BuildOnlySettings                          1 calls
        1 ms  _CheckForUnsupportedTargetFramework        1 calls
        1 ms  GenerateAssemblyInfo                       1 calls
        1 ms  ResolveProjectReferences                   1 calls
        1 ms  AssignTargetPaths                          1 calls
        1 ms  CoreResGen                                 1 calls
        1 ms  ResolveSDKReferences                       1 calls
        1 ms  _CheckForCompileOutputs                    1 calls
        1 ms  SplitResourcesByCulture                    1 calls
        1 ms  _GetProjectReferenceTargetFrameworkProperties   1 calls
        1 ms  ResolveLockFileReferences                  1 calls
        1 ms  IncrementalClean                           1 calls
        2 ms  PrepareForBuild                            1 calls
        2 ms  GenerateTargetFrameworkMonikerAttribute    1 calls
        2 ms  CoreGenerateAssemblyInfo                   1 calls
        2 ms  _ComputeLockFileAnalyzers                  1 calls
        3 ms  _CheckForInvalidConfigurationAndPlatform   1 calls
        6 ms  CopyFilesToOutputDirectory                 1 calls
        6 ms  _SetBuildInnerTarget                       1 calls
       15 ms  _CleanGetCurrentAndPriorFileWrites         1 calls
       60 ms  GenerateBuildRuntimeConfigurationFiles     1 calls
       65 ms  _ComputeLockFileReferences                 1 calls
      183 ms  RunResolvePackageDependencies              1 calls
      245 ms  ResolveAssemblyReferences                  1 calls
      916 ms  CoreCompile                                1 calls
     1644 ms  DispatchToInnerBuilds                      1 calls

Task Performance Summary:
        0 ms  GetAssemblyVersion                         1 calls
        0 ms  GetFrameworkPath                           1 calls
        0 ms  AssignTargetPath                           5 calls
        0 ms  Delete                                     1 calls
        1 ms  RemoveDuplicates                           2 calls
        1 ms  FindAppConfigFile                          1 calls
        1 ms  MakeDir                                    1 calls
        1 ms  AssignCulture                              1 calls
        1 ms  ReadLinesFromFile                          1 calls
        2 ms  WriteCodeFragment                          1 calls
        2 ms  Message                                    3 calls
        3 ms  FindUnderPath                              5 calls
        5 ms  Copy                                       2 calls
        8 ms  ConvertToAbsolutePath                      1 calls
       60 ms  GenerateRuntimeConfigurationFiles          1 calls
      181 ms  ResolvePackageDependencies                 1 calls
      244 ms  ResolveAssemblyReference                   1 calls
      913 ms  Csc                                        1 calls
     1632 ms  MSBuild                                    2 calls

As you can see, Csc is still getting called for subsequent invocations.

Activity

  1. rainersigwald commented on Oct 13, 2016

    @rainersigwald
    Member

    A diag MSBuild log should have a lot of information to help with diagnosing non-incremental builds.

  2. eerhardt commented on Oct 13, 2016

    @eerhardt
    MemberAuthor

    OK, you asked for it:

    build.txt

  3. eerhardt commented on Oct 13, 2016

    @eerhardt
    MemberAuthor

    Looking through it (maybe I should have done that myself right away), it says:

    Input file "obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs" is newer than output file "obj\Debug\netcoreapp1.0\new3test.dll".
    

    @nguerrera ?

  4. eerhardt commented on Oct 13, 2016

    @eerhardt
    MemberAuthor

    I'll attempt at putting up a PR for this.

  5. rainersigwald commented on Oct 13, 2016

    @rainersigwald
    Member
    Target "GenerateAssemblyInfo: (TargetId:45)" in file "C:\Users\eerhardt\.nuget\packages\microsoft.net.sdk\1.0.0-alpha-00000001-01\build\netstandard1.0\Microsoft.NET.GenerateAssemblyInfo.targets" from project "F:\DotNetTest\new3test\new3test.csproj" (target "CoreCompile" depends on it):
    Skipping target "GenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
    Input files: C:\Users\eerhardt\.nuget\packages\microsoft.net.sdk\1.0.0-alpha-00000001-01\build\netstandard1.0\Microsoft.NET.Sdk.props;F:\cli\artifacts\win10-x64\stage2\sdk\1.0.0-preview3-003844\Microsoft.CSharp.CurrentVersion.targets;F:\DotNetTest\new3test\new3test.csproj;F:\cli\artifacts\win10-x64\stage2\sdk\1.0.0-preview3-003844\Microsoft.Common.CurrentVersion.targets
    Output files: obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs
    Done building target "GenerateAssemblyInfo" in project "new3test.csproj".: (TargetId:45)
    Target "CoreCompile: (TargetId:46)" in file "F:\cli\artifacts\win10-x64\stage2\sdk\1.0.0-preview3-003844\Microsoft.CSharp.Core.targets" from project "F:\DotNetTest\new3test\new3test.csproj" (target "Compile" depends on it):
    Building target "CoreCompile" completely.
    Input file "obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs" is newer than output file "obj\Debug\netcoreapp1.0\new3test.dll".
    

    assemblyinfo.cs is stale because it was generated earlier:

    Target "CoreGenerateAssemblyInfo: (TargetId:44)" in file "C:\Users\eerhardt\.nuget\packages\microsoft.net.sdk\1.0.0-alpha-00000001-01\build\netstandard1.0\Microsoft.NET.GenerateAssemblyInfo.targets" from project "F:\DotNetTest\new3test\new3test.csproj" (target "GenerateAssemblyInfo" depends on it):
    ...
      Emitted specified code into "obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs". (TaskId:17)
      Output Item(s): Compile=obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs (TaskId:17)
      Output Item(s): FileWrites=obj\Debug\netcoreapp1.0\new3test.AssemblyInfo.cs (TaskId:17)
    Done executing task "WriteCodeFragment". (TaskId:17)
    Done building target "CoreGenerateAssemblyInfo" in project "new3test.csproj".: (TargetId:44)
    

    And that target isn't incremental.

  6. nguerrera commented on Oct 13, 2016

    @nguerrera
    Contributor

    Fixed by #276

  7. added a commit that references this issue on Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions