-
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
Fix IDE remote analyzer loader on .Net Core #57407
Conversation
src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.Core.cs
Outdated
Show resolved
Hide resolved
@jaredpar I think we had discussed eliminating the |
src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoaderService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoaderService.cs
Outdated
Show resolved
Hide resolved
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.
Fix seems reasonable, as long as we still feel the listing of assemblies is still the right mechanism. But this isn't doing anything worse than it already is.
src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.Core.cs
Outdated
Show resolved
Hide resolved
// The following are special assemblies since they contain IDE analyzers and/or their dependencies, | ||
// but in the meantime, they also contain the host of compiler in remote process. Therefore on coreclr, | ||
// we must ensure they are only loaded once and in the same ALC compiler asemblies are loaded into. | ||
// Otherwise these analyzers will fail to interoperate with the host due to mismatch in assembly identity. |
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.
Do we have a bug tracking the removal of the WorkspaceAnalyzerOptions that's the cause of all of this?
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.
Not sure about this. If this is the intention, could you please file a bug for it? Thanks!
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.
#8605 tracks removal of WorkspaceAnalyzerOptions and potentially seal AnalyzerOptions
Unsure if this is right after all.
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.
Oh right, it is right. I hate this part of our codebase.
I see some shiproom related labels. Please be sure this is targeted to the appropriate branch. |
@RikkiGibson I have rebased against 17.1, thanks |
@@ -0,0 +1,16 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> | |||
<Project Sdk="Microsoft.NET.Sdk"> |
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 have to add a new test project because we currently don't have any IDE tests runs on .Net Core above workspaces layer
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.
LGTM
@@ -1,4 +1,5 @@ | |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
|
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.
|
We ran into an issue that "unnecessary usings" are not fading when IDE analyzers are hosted on .Net Core host. Further investigation shows that the issue might lie in here
The way analyzer loader work on .Net core, MS.CA.Features is loaded into a separate DirectoryLoadContext when used as an IDE analyzer (# 2 in the screenshot), but it's also loaded into Roslyn's ALC when our service is created in ServiceHub host (# 0) therefore
analyzerOptions is not WorkspaceAnalyzerOptions workspaceAnalyzerOptions)
is evaluated to true, even though analyzerOptions is indeed of type WorkspaceAnalyzerOptions, but because the type is from another ALC.Fix #57395