-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Restrict LanguageServer IVTs to a specific namespace #10183
Conversation
…uageServer.Hosting
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.
👀 The real change is in this file.
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.
👀 Here's our definition of RestrictedInternalsVisibleToAttribute
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 think there is probably more that could moved/abstracted out of Hosting and into workspaces (IClientConnection I think would be good, as it feels odd that so many endpoints have a using for the Hosting namespace), but this is still good as is.
I'm going to be out tomorrow. So, rather than "merge and run", I'll wait until Monday. |
Fixes #10096
Microsoft.VisualStudio.Razor.LanguageServerClient
has a reference toMicrosoft.AspNetCore.Razor.LanguageServer
along withInternalsVisibleTo
access. This is unavoidable because we currently run the LanguageServer in-proc in VS when the LSP editor is active. However, over timeLanguageServerClient
has relied on more and more code inLanguageServer
, which can causeMS.ANC.Razor.LanguageServer
to be loaded in VS when it shouldn't be. This change addresses this issue by limiting the types thatLanguageServerClient
has access to.Access is restricted using the
RestrictedInternalsVisibleToAttribute
, which is already supported byMicrosoft.CodeAnalysis.CSharp.BannedApiAnalyzers
. Other than adding our own copy of this attribute and updating theAssemblyInfo.cs
forMS.ANC.Razor.LanguageServer
, this change is entirely mechanical. Essentially, I've just moved types around, and those types fall into two categories:Microsoft.AspNetCore.Razor.LanguageServer.Hosting
namespace, and IVT is restricted to that namespace.MS.CA.Razor.Workspaces
and organized in aProtocol
folder.