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

Remove deprecated engine code #8826

Closed
27 of 31 tasks
danmoseley opened this issue Jun 1, 2023 · 7 comments · Fixed by #10352
Closed
27 of 31 tasks

Remove deprecated engine code #8826

danmoseley opened this issue Jun 1, 2023 · 7 comments · Fixed by #10352
Assignees
Labels
Area: Engine Issues impacting the core execution of targets and tasks. backlog Cost:L Work that requires one engineer up to 4 weeks Epic Groups multiple user stories. Can be grouped under a theme. Priority:2 Work that is important, but not critical for the release size:5 triaged

Comments

@danmoseley
Copy link
Member

danmoseley commented Jun 1, 2023

Backward compatibility note

Please use Visual Studio version 17.12 and lower to upgrade pre-msbuild project format.

Context

About 15 years ago a new MSBuild engine and API was created and the previous code was deprecated with very high servicing bar.
Keeping the code around (and publishing the packages) is a nontrivial liability especially as we try to model and improve our security.

Business justification

Maintanance cost

  • Slashing significant portion of the code that is kept in repository, translated into the production binaries and hence having some form of support/maintanance cost. The LoC proportion of production code (excluding tests) targetting to be removed: 39% (76k/272k)
  • Removing the legacy binaries that we'd otherwise need to security-fix

Engineering culture

  • Improving engineering efficiency - the deprecated code had duplicated and diverging code - so IDE and GH code searching often returns multitude of irrelevant results. There were cases of engineers accidentaly editing the functionality in the deprecated engine instead of in the new one.
  • Community friendliness - our code base will be more lightweight and understandable

Risks

External customers breaking

The packages are published on nuget (Microsoft.Build.Engine, Microsoft.Build.Conversion.Core) with nontrivial download count.

Mitigation(s):

  • Early 2022 a readme for nuget.org landing page for the 2 packages was added explicitly warning the users the package is deprecated and they should move to the new API.
  • The entrypoint classes of the API have been marked as obsolete decade ago, with information about the new API. The notice is exposed on learn.microsoft page: https://learn.microsoft.com/en-us/dotnet/api/microsoft.build.buildengine.engine
  • In 17.11 we added xml doc comments to all members of the public surface of the deprecated packages and the notices are being propagated to learn.microsoft page
  • We'll eventually stop publishing new versions of the package (likely with 17.12 or beyond) - sending a signal that the package is not maintained anymore
  • We might choose to add a vulnerability metadata (or even backfill on already published packages) to make the message even more explicit

Internal customers breaking

We have identified 7 groups of usages accross partner teams:

  • 2 usages in VS legacy project upgrade wizards
  • 4 usages accross the VS codebase in various components and tooling
  • 1 usage in project sytstem tools VS extension

Mitigation(s):

Close cooperation with all affected partner teams:

  • Had the dead code removed (3 cases)
  • Helping them to onboard to a new API (2 cases)
  • Agreeing and documenting breaking change (2 cases) - discontinuing support for upgrading .NET 1.0 and older (pre-MSBuild) project files

Course of action

Removal PRs:

After actions

Background - Original ticket content

This was deprecated about 15 years ago and changes have long been at a high servicing bar. Can the code be removed from main now and serviced out of older branches? (This is done in runtime repo for some packages.) This would simplify the repo, speed up build and tests, and reduce risk of inadvertent changes to it. Likely it would make it easier to switch on new analyzers and warnings in the repo as the old code wouldn't need to be excluded.

@KalleOlaviNiemitalo
Copy link

Would solve #8822 as well.

@rainersigwald rainersigwald added the needs-triage Have yet to determine what bucket this goes in. label Jun 5, 2023
@rainersigwald
Copy link
Member

Last I checked, Visual Studio still depended on it and it had live dependencies into the current code so we couldn't just ship a frozen-in-time version. However, we should definitely look and see if VS has dropped its dependencies (wouldn't that be nice!).

@AR-May AR-May added Priority:2 Work that is important, but not critical for the release backlog Area: Engine Issues impacting the core execution of targets and tasks. and removed needs-triage Have yet to determine what bucket this goes in. labels Jun 6, 2023
@danmoseley
Copy link
Member Author

live dependencies into the current code

can you clarify? meaning it has to change to adapt to changes in the current code? the M.B.F interface itself should be stable, of course.

I'm curious what VS needs it for. BTW an example of something vaguely analogous -- System.Data.SqlClient is at a high servicing bar, though of course fully supported. So we deleted it from main, and now service it out of the 6.0 branch indefinitely. I'm not sure of the long term plan, but I believe there was discussion of a "servicing" repo to gather such things in, as there are numerous other libraries like that in runtime. Not suggesting that would be the right plan here, just that it's doable to remove from main code that is still supported.

@rainersigwald
Copy link
Member

can you clarify? meaning it has to change to adapt to changes in the current code? the M.B.F interface itself should be stable, of course.

Ah, you're quite right! I had mistakenly thought that Microsoft.Build.Engine depended on Microsoft.Build, but it doesn't. Conversion does, though--and with InternalsVisibleTo, which is a bit scary. Still worth a detailed look!

@JanKrivanek JanKrivanek self-assigned this May 20, 2024
@JanKrivanek
Copy link
Member

JanKrivanek commented May 23, 2024

(not maintained here - moved to ticket description)


Course of action:

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented May 23, 2024

I'm a bit surprised that you're only adding docs and not ObsoleteAttribute. (It doesn't have AttributeTargets.Assembly though.)

ObsoleteAttribute on .NET Framework does not support separately-suppressible diagnostic codes, but IIRC it's possible to define an internal ObsoleteAttribute with this support and it'll be recognised by the compiler.

@JanKrivanek
Copy link
Member

To deliver the message ASAP it's easier to follow the lowest risk path (so no breaking changes).
We can possibly add Obsolete attributes after the docs are updated. It all depends on actual timelines of removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Engine Issues impacting the core execution of targets and tasks. backlog Cost:L Work that requires one engineer up to 4 weeks Epic Groups multiple user stories. Can be grouped under a theme. Priority:2 Work that is important, but not critical for the release size:5 triaged
Projects
None yet
6 participants