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

Load solutions out-of-proc #70240

Merged

Conversation

jasonmalinowski
Copy link
Member

@jasonmalinowski jasonmalinowski commented Oct 4, 2023

This brings a few benefits:

  1. It's possible that the user might have an 8.0 SDK but only a 7.0 runtime installed; in that case, our language server will run with the 7.0 runtime, but will fail to find an MSBuild since the only one on the machine might be the 8.0 version which is not runnable. This enures we can still function in that scenario. We'll also fall back to using a .NET Framework MSBuild if somehow that's all you have.
  2. When we loaded an MSBuild, that sets environment variables, which might not be the same variables set if we're registering a different version in our child processes. But the environment variables might get inherited, which could result in surprises.

In this PR I'm also removing the fallback flag to enable in-proc builds; we never needed it and no bugs got filed, so just removing it for good.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1886993

We had an option as a fallback in case of the out-of-proc build had
bugs, but we haven't had any reports of bugs, so just removing it.
@jasonmalinowski jasonmalinowski self-assigned this Oct 4, 2023
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner October 4, 2023 21:34
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 4, 2023
public Task<bool> IsProjectFileSupportedAsync(string projectFilePath, CancellationToken cancellationToken)
public Task<bool> HasUsableMSBuildAsync(string projectOrSolutionFilePath, CancellationToken cancellationToken)
{
return Task.FromResult(TryEnsureMSBuildLoaded(projectOrSolutionFilePath));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still funky that HasUsableMSBuildAsync() implicitly triggers an actual load, but the hope is this goes away once we can reliably do all discovery in-proc.

var buildHost = await buildHostProcessManager.GetBuildHostAsync(BuildHostProcessManager.BuildHostProcessKind.NetCore, CancellationToken.None);

// If we don't have a .NET Core SDK on this machine at all, try .NET Framework
if (!await buildHost.HasUsableMSBuildAsync(solutionFilePath, CancellationToken.None))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this logic move into GetBuildHostAsync, where the reverse fallback already lives? Would be nice if all the fallback logic was in one place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to leave it since this will get refactored further in a week or two.

This brings a few benefits:

1. It's possible that the user might have an 8.0 SDK but only a 7.0
   runtime installed; in that case, our language server will run with
   the 7.0 runtime, but will fail to find an MSBuild since the only
   one on the machine might be the 8.0 version which is not runnable.
   This ensures we can still function in that scenario. We'll also fall
   back to using a .NET Framework MSBuild if somehow that's all you
   have.
2. When we loaded an MSBuild, that sets environment variables, which
   might not be the same variables set if we're registering a
   different version in our child processes. But the environment
   variables might get inherited, which could result in surprises.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1886993
@jasonmalinowski jasonmalinowski merged commit 49e5f55 into dotnet:main Oct 5, 2023
23 of 24 checks passed
@jasonmalinowski jasonmalinowski deleted the parse-solution-files-oop branch October 5, 2023 01:48
@ghost ghost added this to the Next milestone Oct 5, 2023
@jjonescz jjonescz modified the milestones: Next, 17.9 P1 Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants