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 the EditorFeatures.Wpf dependency from Remote.ServiceHub #45115

Merged
merged 3 commits into from
Jul 7, 2020

Conversation

sharwell
Copy link
Member

No description provided.

Copy link
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -32,6 +32,7 @@
<PackageReference Include="Microsoft.VisualStudio.Imaging" Version="$(MicrosoftVisualStudioImagingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.StandardClassification" Version="$(MicrosoftVisualStudioLanguageStandardClassificationVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.Intellisense" Version="$(MicrosoftVisualStudioLanguageIntellisenseVersion)" />
<PackageReference Include="Microsoft.VisualStudio.RemoteControl" Version="$(MicrosoftVisualStudioRemoteControlVersion)" />
Copy link
Member

Choose a reason for hiding this comment

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

This may be problematic, since this now means VS for Mac needs to ship this binary if they're not. Do we need to move this up a layer to the VS layer rather than down?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a small, netstandard2.0-compatible binary. Today it's used by our Remote.ServiceHub implementation; perhaps we could reorganize the code to remove this requirement but if it doesn't cause a problem it might not be worth the hurdles.

Copy link
Member

Choose a reason for hiding this comment

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

We already ship RemoteControl. Here's the list of all assemblies in VSMac for reference: https://gist.github.com/KirillOsenkov/7d829534a037c2b3545c95d569f34469

Copy link
Member

Choose a reason for hiding this comment

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

@KirillOsenkov: even if you're shipping it, does it function? It looks like the code we see uses a bunch of registry and Windows-specific APIs -- do you have a cross-plat version of it or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

Registry is implemented under Mono. The PInvokes are only called on Windows, under guarded runtime checks. I've checked the code under the VSRemoteControl repo, and it all looks okay.

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 doesn't add anything to the MEF composition, so the only way this could get called on Mac is if the code is being invoked explicitly.

Copy link
Member

Choose a reason for hiding this comment

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

If we want to make sure, we can take this change to guard against potential misuse in the future.
sharwell#2

Copy link
Member Author

Choose a reason for hiding this comment

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

@genlu Can you submit that as a follow-up pull request?

Copy link
Member

Choose a reason for hiding this comment

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

Yea, sure. Will do if we think it'd help.

Copy link
Member

Choose a reason for hiding this comment

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

@sharwell sharwell marked this pull request as draft June 13, 2020 00:12
@Cosifne
Copy link
Member

Cosifne commented Jun 17, 2020

@sharwell
When do you expect this PR should go in? Because of the dependency, in Live Unit Testing we need to add an additional NuGet feeds to restore Microsoft.VisualStudio.CodingConventions.
It is not blocking us but would be great if the additional feed could be removed.

@genlu
Copy link
Member

genlu commented Jun 26, 2020

Any update on this one? Is it still blocked? @sharwell @jasonmalinowski

@sharwell
Copy link
Member Author

Any update on this one?

The problem concerns two features:

  1. Suggest usings for types in .NET Framework assemblies
  2. Suggest usings for types in NuGet packages

Both of these features rely on both of the following dependencies:

  1. Microsoft.CodeAnalysis.Elfie
  2. Microsoft.VisualStudio.RemoteControl

Both of those dependencies support execution on .NET Core, but both of these dependencies use Windows APIs which make them runtime agnostic but not OS agnostic (i.e. they will build for Mac but they will not run on Mac).

We have several options for moving forward, none of which is particularly great:

  1. Remove the features and dependencies altogether, and add them back in the future without the problematic dependencies.
  2. Use an approach like this pull request with the understanding that the features cannot work on Mac and the exceptions that get thrown might prove surprising and/or difficult to catch.
  3. Break up the OOP features so it can distinguish between OS and use different MEF compositions accordingly.

For me, the easiest option is (2), while the cleanest option is (1).

@genlu
Copy link
Member

genlu commented Jun 29, 2020

Is it possible to encapsulate access to those two dependencies into MEF services and keep it in EditorFeatures.Wpf? So if we can't find the import in EditorFeature layer, then the feature will just be unavailable?

@genlu
Copy link
Member

genlu commented Jun 29, 2020

Welp, it seems @tmat already made this change in #45505

jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this pull request Jun 29, 2020
This reverts commit f755e8a. That
change meant our EditorFeatures code was using DllImports in the
cross-platform binary, and we weren't sure what that would do in
VS for Mac if that code ran. It also brought a dependency on
Microsoft.VisualStudio.RemoteControl, which also seems to depend on
various Windows specific APIs.

We'll finish up the decision of what to do in
dotnet#45115
@dibarbet
Copy link
Member

This will need to be targeted back to master

@sharwell
Copy link
Member Author

sharwell commented Jun 29, 2020

This will need to be targeted back to master

@dibarbet GitHub will automatically retarget this after dev16.8-preview1 is merged to master and deleted.

@dibarbet
Copy link
Member

This will need to be targeted back to master

@dibarbet GitHub will automatically retarget this after dev16.8-preview1 is merged to master and deleted.

As I understand it from @JoeRobich, once I delete the branch the PRs will be closed. Before I delete it I will go back and retarget.

@sharwell
Copy link
Member Author

@dibarbet That used to be correct. GitHub changed the behavior because we kept complaining about it.

@dibarbet dibarbet changed the base branch from release/dev16.8-preview1 to master June 30, 2020 18:14
@dibarbet
Copy link
Member

CHanged the base manually, github wouldn't let us delete the branch with open PRs targeting it

@sharwell sharwell marked this pull request as ready for review July 1, 2020 19:25
@sharwell sharwell merged commit 7b4bfaa into dotnet:master Jul 7, 2020
@ghost ghost added this to the Next milestone Jul 7, 2020
@sharwell sharwell deleted the no-wpf branch July 7, 2020 21:58
@JoeRobich JoeRobich modified the milestones: Next, 16.8.P1 Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.