-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Switch MSBuildWorkspace to running builds out of proc #70469
Switch MSBuildWorkspace to running builds out of proc #70469
Conversation
84d5350
to
1fa1478
Compare
070b828
to
52be409
Compare
#if NETCOREAPP | ||
// This property ensures that XAML files will be compiled in the current AppDomain | ||
// rather than a separate one. Any tasks isolated in AppDomains or tasks that create | ||
// AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. | ||
{ "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is still necessary, it doesn't belong in this assembly anymore since the "is this .NET Core?" test should be in a different process. (And if it's generally necessary for XAML projects, then we should have this as a central fix.)
6d3d5c9
to
6478bf9
Compare
Some of the strings were used in the build host, and some were used by the main library; this splits them in preparation for removing the project reference entirely.
ea08f53
to
ebd68d6
Compare
ebd68d6
to
e7f2950
Compare
<Output TaskParameter="TargetOutputs" ItemName="BuildOutputInPackage" /> | ||
</MSBuild> | ||
</Target> | ||
<Target Name="GetBuildHostDebugSymbols"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure out what scenario symbol packing was happening in, so just removing it.
62e635c
to
79bfce5
Compare
<!-- | ||
The package "Microsoft.CodeAnalysis.Analyzer.Testing" brings in an earlier version of these NuGet dependencies than | ||
is expected by the NET SDK used in the Workspace.MSBuild UnitTests. In order to test against the same verion of NuGet | ||
as our configured SDK, we must set the version to be the same. | ||
--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NuGet dependencies don't matter anymore, so this workaround can be removed for good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes me very happy :)
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsVersion)" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were implicitly coming along with the BuildHost ProjectReference, but now it's just explicit.
@@ -12,7 +12,6 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" /> | |||
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="$(BenchmarkDotNetDiagnosticsWindowsVersion)" /> | |||
<PackageReference Include="Microsoft.Build.Locator" Version="$(MicrosoftBuildLocatorVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR generally goes through the repo and removes uses of MSBuild Locator that was used in places that were using MSBuildWorkspace. Those just aren't necessary anymore.
This binary is implicitly a dependency of the Razor source generator, so needs to be present for any time the generator is running and is running in design time mode. That's not going to happen usually but would happen in any MSBuildWorkspace scenario.
The tests we have here were testing the underlying code by directly creating loggers, but we don't have an MSBuild in process anymore for those tests to work. Rather than having a BuildHost specific test bed we'll just change the tests to test the end-to-end.
On .NET Framework, Path APIs in very invalid paths throw exceptions. On .NET Core, they do something reasonable and then you might just FileNotFound later when the file doesn't exist. This updates the tests accordingly.
We'll still keep the .NET Core build host around, since the process isolation still ensures binaries deployed as a part of the application don't break MSBuild.
Referencing Microsoft.Extensions.Logging.Abstractions breaks source build because 6.0.2 isn't available. But 6.0.0 is so we can just use that.
If it's already crashed and exited, then there's no point in trying to shutdown communication with it -- it's already gone.
If the process is dead we shouldn't be trying to send an RPC to it.
When we dispose a process, it fires events which causes us to remove it from the map.
dd359c6
to
a1f6b59
Compare
I'll be making a GitHub project later this week to track the follow-up work to this PR. |
MSBuildLocator is no longer needed since dotnet/roslyn#70469 and the workarounds for NuGet.Framework can be removed too.
[main] Update dependencies from dotnet/roslyn, nuget/nuget.client - Add dependency on Microsoft.Extensions.Logging 8.0.0 match the version that roslyn wants dotnet/roslyn#71916 - Revert "Add dependency on Microsoft.Extensions.Logging 8.0.0" This reverts commit f947f38. - Add temporary reference to Microsoft.Extensions.Logging 8.0.0 - Cleanup dependencies, remove MSBuildLocator MSBuildLocator is no longer needed since dotnet/roslyn#70469 and the workarounds for NuGet.Framework can be removed too.
This switches MSBuildWorkspace over to using out-of-proc builds using the same mechanism we use for our LSP process. This brings a few advantages:
The one major caveat here is we did have some entrypoints for MSBuildWorkspace that accept an ILogger; currently these will be broken. I'm still reaching out to folks to decide what to do here. We can simply obsolete them, or try to get them to work in a few scenarios. (For example, I could detect if the logger you passed is a well known built in logger we can just recreate that on the OOP side). This will also break any apps that were really expecting the build to be in-proc (like by tinkering with MSBuild properties in advance) but such a behavior wasn't really supported anyways.
Work still to do prior to merge:
Things that will be tracked for follow-up: