Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Remove dependency on code fixers and refactorings from Roslyn internals #132

Open
kzu opened this issue Mar 30, 2021 · 0 comments
Open

Remove dependency on code fixers and refactorings from Roslyn internals #132

kzu opened this issue Mar 30, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@kzu
Copy link
Member

kzu commented Mar 30, 2021

Currently we leverage built-in (internals, but fairly easily accessible) internal
code fixers and refactorings to scaffold the basic type boilerplate, just as it
would be generated on the IDE by applying the provided code fix providers
(specifically the "Implement Abstract Class", "Implement Interface Members"
and "Generate Default Constructors").

This creates a tighter than necessary coupling with the specific versions of
Roslyn we support, forcing us to ship one version of the "tools" dependencies
for each supported Roslyn version (atm 3.8, 3.9 and 3.10). This adds unnecessary
bulk to the package size, but also adds non-trivial requirements for integration
testing and maintainability burden as future Roslyn versions come out (since
we need to support each major.minor specifically).

At this point it's becoming clear that it might be better to just reimplement
these built-in scaffold behaviors natively on top of plain C# syntax, since (for
the moment) we know C# is going to be the only supported generator for a
while. We also have the dynamic proxy fallback just in case. So this would be
a big win in terms of simplicity and maintainability.

The non-trivial part of the issue is that, "shockingly", most of the behavior that
drives the built-in code fixers/refactorings, relies on entirely internal behavior
we'll need to extract/copy and then keep up to date. But the trade-off is to
keep and ship multiple roslyn "toolsets", so it's not like the (current) alternative
has no cost.

A quick spike on default constructors generator was promising, so it might be
worth trying to replace all three built-in behaviors and remove all the internals
accesses.

As an added side-benefit, this should have a noticeable impact in performance
too, since we currently have to spin up a proper workspace and project for the
scaffolding to actually work at all.

@kzu kzu added the enhancement New feature or request label Mar 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant