Project-system: Redundant builds in Visual studio 2019 16.6.0 Preview 5.0

Created on 11 May 2020  ยท  13Comments  ยท  Source: dotnet/project-system

_This issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard._


[regression] [worked-in:16.5.4]
Issue: when using the 16.6.0 Preview 5.0 version of Visual studio Professional, we are facing an issue that Visual studio builds projects that have not changed. This leads to very long builds on bigger solutions.

Note: the same solution builds ok using the 16.5.4 version of Visual studio.

The behavior can be reproduced using the following steps:

  • run Visual studio 16.6.0 Preview 5.0
  • create a new project โ€“ Class library (c#, .NET Core)
  • build the project (in Solution explorer, right click the project node, select โ€œBuildโ€)
  • in the Output window, observe that the project has been built:
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  • build the project again, now the Output correctly indicates that the project was up-to-date and no build was needed:
    ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

So far โ€“ all good.

Now:

  • Close the Visual studio now <-- this is an important step to observe the problem
  • Open Visual studio again, load the project
  • Build the project for the first time, check the Output (_ok so far_):
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  • Build the project for the second time, check the Output โ€“ it indicates that a build was needed (_this is wrong_):
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  • Build the project for the third time, check the Output โ€“ it indicates that a build was needed (_this is wrong_):
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

This wrong behavior will magically disappear if you modify the .csproj file (eg. add a space, delete a space). After a first build, the subsequent builds again correctly indicate that the project is up-to-date.
(while this can be a workaround on small projects, on bigger solutions, it is impractical to modify all the .csproj files to avoid the issue)

Additional info: running on Windows 10 (1909). No 3rd party anti-virus. Tried both with Windows Defender real time protection turned off an on โ€“ no difference.


Original Comments

Visual Studio Feedback System on 5/7/2020, 11:46 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Visual Studio Feedback System on 5/10/2020, 10:58 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. Weโ€™ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

Bug Feature-Up-to-date Regression Triage-Approved

All 13 comments

1>FastUpToDate: Adding UpToDateCheckBuilt outputs: (ConsoleApp7)
1>FastUpToDate: 'C:\Users\oscalles\source\repos\ConsoleApp7\ConsoleApp7\bin\Debug\net5.0\ConsoleApp7.dll' (ConsoleApp7)
1>FastUpToDate: 'C:\Users\oscalles\source\repos\ConsoleApp7\ConsoleApp7\obj\Debug\net5.0\ConsoleApp7.pdb' (ConsoleApp7)
1>FastUpToDate: 'C:\Users\oscalles\source\repos\ConsoleApp7\ConsoleApp7\obj\Debug\net5.0\ConsoleApp7.dll' (ConsoleApp7)
1>FastUpToDate: 'C:\Users\oscalles\source\repos\ConsoleApp7\ConsoleApp7\bin\Debug\net5.0\ConsoleApp7.pdb' (ConsoleApp7)
1>FastUpToDate: The set of AdditionalDependentFileTimes was changed more recently (5/14/2020 1:55:17 PM) than the earliest output 'C:\Users\oscalles\source\repos\ConsoleApp7\ConsoleApp7\bin\Debug\net5.0\ConsoleApp7.dll' (5/14/2020 1:51:55 PM), not up to date. (ConsoleApp7)

Can we change the log say which files within AdditionalDependentFilesTimes changed?

Is there any workaround for VS 16.6 before 16.7 release?

@ipanin not a great one. If you rebuild, the up-to-date check will get back into a good state.

A workaround that works for my solution with 85 projects:

  1. close Visual Studio
  2. delete .vs folder
  3. delete all bin folders
  4. delete all obj folders
  5. open and build the solution
  6. build again - if there are any projects that always build, delete their bin & obj folders - you may have to do this a few times
  7. MOST IMPORTANT: never close Visual Studio, or the problem will reappear

Thank you @Jinjinov your steps worked for me. ๐Ÿ‘

  1. MOST IMPORTANT: never close Visual Studio, or the problem will reappear

So FWIW I did indeed run into this problem again after closing the solution. But was then able to work around this by:

  1. Closing solution.
  2. Re-opening solution.
  3. Cleaning solution
  4. Rebuilding it.

Not sure if I was lucky, but I will monitor in case I close it again. For instance, I am not sure (re-)closing the solution (step 1) is necessary.

In my case, I closed it forgetting of this issue/condition and tried the above. This is going to take an adjustment. :P

Rebuild will get things back into a good state (see https://github.com/dotnet/project-system/issues/6181#issuecomment-633201307).

Yeah I did try that the first time I encountered this issue @drewnoakes but it didn't work for whatever reason. Now it seems to be working well. Or at least, for a workaround. :)

OK, I see the source of my confusion now. Rebuild does get everything back into a good state, but there is a subsequent build required to do so. In my case, at least. So:

  1. Rebuild.
  2. Build again (will rebuild everything again, no cache, even though Rebuild should have cached everything).
  3. Build _again_ (will build from cache).

When I previously attempted to use Rebuild, I tried building again (step 2) and it didn't seem to be working, so gave up. The trick was to build it a 2nd time (step 3) to get everything working as expected.

Woohoo... I can confirm this is fixed in 16.7.0. ๐ŸŽ‰ Thank you for all your diligent work over there, team! Visual Studio is starting to feel really solid these days.

Also a shout of appreciation for dealing with those of us who are continuously learning patience and get a little grumpy when things don't fall according to perfect expectations. ๐Ÿ˜Š๐Ÿ˜‡

Nothing has been fixed in 16.7.0 and 16.7.1. So random rebuilds continue with each click on the "build".

========= Build: 1 succeeded, 0 failed, 71 up-to-date, 2 skipped ==========
========== Build: 21 succeeded, 0 failed, 51 up-to-date, 2 skipped ==========
========== Build: 1 succeeded, 0 failed, 71 up-to-date, 2 skipped ==========
========== Build: 7 succeeded, 0 failed, 65 up-to-date, 2 skipped ==========

@NektoDron Please turn on verbose logs via the following and file a new bug:

image

Was this page helpful?
0 / 5 - 0 ratings