This repository was archived by the owner on Jun 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 75
Work to perform build-time codegen completed #28
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reasons to go with an out of process console app are: - We need to use the latest 2.9 Roslyn MSBuildWorkspace which properly supports decoupling with the MSBuild version and locating it via the MSBuildLocator - We cannot bundle that Roslyn in a VS extension because it might conflict with the built-in version - Resolving the Roslyn assemblies from within the MSBuild process proved very challenging: resolving to the VS-installed versions caused errors, would require maintaining a pre-2.9 version too, and ultimately never properly matched assemblies to the MSBuild resolved versions. This reading uses Mono.Options to configure the parameters (a total joy to use!) and by default will emit the XML with the project metadata needed to load it programmatically to a workspace via the output stream, unless a file is specified with -o.
The external process should be longer lived so that the MSBuildWorkspace.Create call (by far the most expensive since it needs to set up a whole new MEF host with all Roslyn services, in addition to resolving the MSBuild framework assemblies and all SDK-style targets and assemblies too) can be reused across calls to ReadProject (renamed to OpenProject). By switching to the JsonRpc style, the external process can live as long as the build (or the AppDomain?) and maintain a single instance of the MSBuildWorkspace, which then is reused across OpenProject calls. The RPC interface exposed allows creating new workspaces on demand (disposing the existing one automatically, so that it can live for the entire duration of the VS AppDomain eventually. In addition, the console app now triggers a background resolving of all the relevant assemblies and MEF eagerly, so that by the time the actual project reading happens, all of the Roslyn components have already warmed up. This combination of optimizations brought down the time for reading the test project and all its project references from 20+ seconds (with the single-use commandline for each project) to ~5 seconds (not counting the warm-up period of ~2 seconds).
Also, since build-time works great now, we don't need to generate warnings for missing and outdated mocks. Those can be just Info, and Warning only when AutoCodeFix is enabled.
The project reader moved over to the AutoCodeFix repository
This happens on CI for example, because the nuget cache may not be populated.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.