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

Add InternalsVisibleTo to the VSMac Razor assembly. #39673

Merged
merged 4 commits into from
Nov 11, 2019

Conversation

KirillOsenkov
Copy link
Member

@KirillOsenkov KirillOsenkov requested a review from a team as a code owner November 4, 2019 19:09
Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

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

LGTM

@KirillOsenkov
Copy link
Member Author

@jinujoseph would you please help with landing this? Thanks!

@jinujoseph jinujoseph added Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. labels Nov 4, 2019
@jinujoseph jinujoseph added this to InQueue in IDE: CommunityPR via automation Nov 4, 2019
IDE: CommunityPR automation moved this from InQueue to LGTM Nov 4, 2019
@jinujoseph jinujoseph added this to the 16.5.P1 milestone Nov 4, 2019
@sandyarmstrong
Copy link
Member

@jinujoseph would it be possible to get this for 16.4?

@jasonmalinowski
Copy link
Member

@sandyarmstrong It's a simple change from the tech side, but that may require filling out a QB template internally to get approval. (not sure if we cover this under that rule or not). @jinujoseph?

@NTaylorMullen
Copy link
Contributor

I'm not convinced this warrants a QB insertion/exception. I've worked around the limitation on the Razor side and even if the change were to make it into 16.4 we wouldn't be able to consume it on the Razor side because of the Roslyn binary mismatches in VSwin/VSmac.

@sandyarmstrong was there something in particular you were concerned about?

@KirillOsenkov
Copy link
Member Author

We need IVTs regardless because I don't want to be cornered into committing design crimes again like we did last week.

Copy link
Member

@sandyarmstrong sandyarmstrong left a comment

Choose a reason for hiding this comment

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

There are three other projects missing this change:

  • src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj
  • src/VisualStudio/Razor/Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient.csproj
  • src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj

@jasonmalinowski
Copy link
Member

@sandyarmstrong What are those needed for? IVT policy for those is very different and would result in this PR being held up likely.

@KirillOsenkov KirillOsenkov requested a review from a team as a code owner November 5, 2019 00:30
@KirillOsenkov
Copy link
Member Author

We've realized that IVTs are now specified in more than one place. It used to be that we could go to a single file and it managed all the IVTs conveniently. Now we found the places Sandy found, and while we don't need MS.VS.LanguageServices and Razor.RemoteClient, we do need Microsoft.CodeAnalysis.Workspaces.dll, for IDynamicFileInfoProvider which is internal.

@jasonmalinowski
Copy link
Member

@KirillOsenkov Are those new ones you added being built with the MonoDevelop key, or are new Razor-build binaries?

@KirillOsenkov
Copy link
Member Author

@jasonmalinowski these are all in the Razor codebase and built with the Razor key. The Razor team owns the VSMac experience ;)

@jasonmalinowski
Copy link
Member

Is there a reason the existing assemblies that already have IVT aren't being used? I would have imagined that code was all shared between both platforms.

My line of questioning here mostly is us adding new IVTs is something we aren't doing freely anymore; if there are different projects perhaps because they're coming from different builds, then it means we need to at least somewhat understand what is going on around us.

@KirillOsenkov
Copy link
Member Author

Unfortunately yes, we have a reason. The Windows assemblies use CPS for the project system functionality, and the implementation of IDynamicFileInfoProvider on the Windows side is all in the Roslyn VS layer (Microsoft.VisualStudio.LanguageServices.dll) that VSMac can't use.

Believe me, we've committed quite a few design crimes to work around the IVTs and what we came up with is unfortunately the most realistic tactical solution. We placed a base class into the assembly that can see Roslyn's internals, and derived from it in the assembly that doesn't see Roslyn internals. Basically our design was guided by where we have IVTs and where we don't. I personally think this is not a nice world to live in.

As an aside I'm starting to plan a campaign to implement Roslyn support for IgnoresAccessChecksTo, Eli has even submitted a PR: https://github.com/aelij/IgnoresAccessChecksToGenerator. There's just so much unnecessary friction in the ecosystem due to the IVTs that frankly we could all save quite a lot of time and resources if we had IACT.

@sharwell
Copy link
Member

sharwell commented Nov 6, 2019

The IVTs fall into four categories for VS for Mac:

  1. IVT from Microsoft.CodeAnalysis.ExternalAccess.Razor to partner code: These are allowed
  2. Restricted IVT to partner code: These are allowed
  3. IVT from another assembly to partner code that never loads in Visual Studio on Windows: These are allowed under the MonoDevelop exclusion, but without warranty. If we change this internal code and the partner assembly breaks (source or binary breaking change), the partner bears full responsibility for updating to account for the change since they opted out of the compatibility policy
  4. IVT from another assembly to partner code that may load in Visual Studio on Windows, either in box or as part of a Microsoft-supported extension: These are not allowed (restricted IVTs must be used instead)

@KirillOsenkov
Copy link
Member Author

OK we missed 16.4, can we merge this into master please?

@sharwell
Copy link
Member

sharwell commented Nov 7, 2019

@KirillOsenkov Can you clarify which of the four categories the Workspaces IVT falls into?

@KirillOsenkov
Copy link
Member Author

@sharwell #3, MonoDevelop exclusion please

@sharwell
Copy link
Member

sharwell commented Nov 7, 2019

Thanks, can you move it into the exclusions block and mark it as not loading in Visual Studio?

<!-- BEGIN MONODEVELOP
These MonoDevelop dependencies don't ship with Visual Studio, so can't break our
binary insertions and are exempted from the ExternalAccess adapter assembly policies.
-->
<InternalsVisibleTo Include="MonoDevelop.Ide" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.Refactoring" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.CSharpBinding" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.VBNetBinding" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.Ide.Tests" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.Refactoring.Tests" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.CSharpBinding.Tests" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="MonoDevelop.VBNetBinding.Tests" Key="$(MonoDevelopKey)" LoadsWithinVisualStudio="false" />
<!-- this is currently built externally, as part of the MonoDevelop build -->
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Cocoa" LoadsWithinVisualStudio="false" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Cocoa.UnitTests" LoadsWithinVisualStudio="false" />
<!-- END MONODEVELOP -->

@sharwell
Copy link
Member

sharwell commented Nov 7, 2019

If it doesn't directly apply to MonoDevelop, you could create a new block with a similar clarifying comment following the example from MonoDevelop.

….csproj

Co-Authored-By: Sam Harwell <sam@tunnelvisionlabs.com>
@sharwell sharwell merged commit 40f4f25 into dotnet:master Nov 11, 2019
IDE: CommunityPR automation moved this from LGTM to Completed Nov 11, 2019
@KirillOsenkov KirillOsenkov deleted the dev/kirillo/ivt-razor-mac branch November 11, 2019 20:56
@jinujoseph jinujoseph moved this from Completed-Sprint161 to Completed-2019 in IDE: CommunityPR Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.
Projects
IDE: CommunityPR
  
Completed-2019
Development

Successfully merging this pull request may close these issues.

None yet

8 participants