-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analyzer redirecting API (#74820)
* Add IAnalyzerAssemblyResolver public API * Load analyzers directly in ServiceHub * Handle missing assembly on disk * Redirect path only for serialization * Redirect full path on creation * Add separate redirector API * Remove superfluous methods * Report caught exceptions * Make the API RestrictedInternalsVisibleTo * Remove unnecessary resolver modification * Fixup after merge * Remove redirecting from AnalyzerFileReference * Redirect analyzers in ProjectSystemProject * Expand doc comment * Improve code
- Loading branch information
Showing
9 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Workspaces/Core/Portable/Workspace/ProjectSystem/IAnalyzerAssemblyRedirector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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. | ||
|
||
namespace Microsoft.CodeAnalysis.Workspaces.AnalyzerRedirecting; | ||
|
||
/// <summary> | ||
/// Any MEF component implementing this interface will be used to redirect analyzer assemblies. | ||
/// </summary> | ||
/// <remarks> | ||
/// The redirected path is passed to the compiler where it is processed in the standard way, | ||
/// e.g., the redirected assembly is shadow copied before it's loaded | ||
/// (this could be improved in the future since shadow copying redirected assemblies is usually unnecessary). | ||
/// </remarks> | ||
internal interface IAnalyzerAssemblyRedirector | ||
{ | ||
/// <param name="fullPath"> | ||
/// Original full path of the analyzer assembly. | ||
/// </param> | ||
/// <returns> | ||
/// The redirected full path of the analyzer assembly | ||
/// or <see langword="null"/> if this instance cannot redirect the given assembly. | ||
/// </returns> | ||
/// <remarks> | ||
/// <para> | ||
/// If two redirectors return different paths for the same assembly, no redirection will be performed. | ||
/// </para> | ||
/// <para> | ||
/// No thread switching inside this method is allowed. | ||
/// </para> | ||
/// </remarks> | ||
string? RedirectPath(string fullPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters