-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 6640-CA2225-false-positive-when-base-class-h…
…as-method
- Loading branch information
Showing
493 changed files
with
10,726 additions
and
4,023 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## RS1022: Do not use types from Workspaces assembly in an analyzer | ||
|
||
Diagnostic analyzer types should not use types from Workspaces assemblies. Workspaces assemblies are only available when the analyzer executes in Visual Studio IDE live analysis, but are not available during command line build. Referencing types from Workspaces assemblies will lead to runtime exception during analyzer execution in command line build. | ||
|
||
|Item|Value| | ||
|-|-| | ||
|Category|MicrosoftCodeAnalysisCorrectness| | ||
|Enabled|True| | ||
|Severity|Warning| | ||
|CodeFix|False| | ||
--- | ||
|
||
> **Warning** | ||
> | ||
> The analysis performed by RS1022 is slow and relies on implementation details of the JIT compiler for correctness. | ||
> Authors of compiler extensions are encouraged to use the stricter (and faster) analyzer RS1038 instead of this rule. | ||
> | ||
> RS1038 is enabled by default. To enable RS1022 instead, the following configuration may be added to **.globalconfig**: | ||
> | ||
> ```ini | ||
> roslyn_correctness.assembly_reference_validation = relaxed | ||
> ``` |
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,46 @@ | ||
## RS1038: Compiler extensions should be implemented in assemblies with compiler-provided references | ||
|
||
Types which implement compiler extension points should not be declared in assemblies that contain references to assemblies which are not provided by all compilation scenarios. Doing so may cause the feature to behave unpredictably. | ||
|
||
|Item|Value| | ||
|-|-| | ||
|Category|MicrosoftCodeAnalysisCorrectness| | ||
|Enabled|True| | ||
|Severity|Warning| | ||
|CodeFix|False| | ||
--- | ||
|
||
This rule helps ensure compiler extensions (e.g. analyzers and source generators) will load correctly in all compilation | ||
scenarios. Depending on the manner in which the compiler is invoked, some assemblies may not be present during a build, | ||
and attempting to reference them will result in exceptions that prevent the compiler extension from loading. RS1038 is | ||
the most strict and best performing validation for this scenario. | ||
|
||
RS1038 is enabled by default unless relaxed validation has been manually enabled in **.globalconfig** as described in | ||
[RS1022](RS1022.md). | ||
|
||
### Rules for compiler feature references | ||
|
||
* Compiler features supporting C# code should only reference the NuGet packages **Microsoft.CodeAnalysis.Common** and/or **Microsoft.CodeAnalysis.CSharp** | ||
* Compiler features supporting Visual Basic code should only reference **Microsoft.CodeAnalysis.Common** and/or **Microsoft.CodeAnalysis.VisualBasic** | ||
* Compiler features supporting both C# and Visual Basic should only reference **Microsoft.CodeAnalysis.Common** | ||
* Compiler features should not be implemented in assemblies containing a reference to **Microsoft.CodeAnalysis.Workspaces.Common** | ||
|
||
> **Note** | ||
> | ||
> This analyzer only checks references to the core Roslyn assemblies. Compiler extensions with other dependencies may | ||
> face restrictions and/or packaging requirements outside the scope of this analyzer. | ||
### Compiler extension points | ||
|
||
The following compiler extension points are examined by this analyzer: | ||
|
||
* `DiagnosticAnalyzer` | ||
* `DiagnosticSuppressor` | ||
* `ISourceGenerator` | ||
* `IIncrementalGenerator` | ||
|
||
### Other extension points | ||
|
||
Some extension points provided by Roslyn are IDE extensions (e.g. code fixes and completion providers). These features | ||
may ship in the same package as compiler features, but should be implemented in their own assembly since they require a | ||
reference to non-compiler package **Microsoft.CodeAnalysis.Workspaces.Common**. |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
<!-- Whenever altering this or other Source Build files, please include @dotnet/source-build-internal as a reviewer. --> | ||
|
||
<Project> | ||
|
||
<PropertyGroup> | ||
<GitHubRepositoryName>roslyn-analyzers</GitHubRepositoryName> | ||
<SourceBuildManagedOnly>true</SourceBuildManagedOnly> | ||
<SourceBuildTrimNetFrameworkTargets>true</SourceBuildTrimNetFrameworkTargets> | ||
</PropertyGroup> | ||
|
||
</Project> |
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 |
---|---|---|
@@ -1,5 +1,18 @@ | ||
<!-- Whenever altering this or other Source Build files, please include @dotnet/source-build-internal as a reviewer. --> | ||
<!-- See aka.ms/dotnet/prebuilts for guidance on what pre-builts are and how to eliminate them. --> | ||
|
||
<UsageData> | ||
<IgnorePatterns> | ||
<UsagePattern IdentityGlob="*/*" /> | ||
<UsagePattern IdentityGlob="Microsoft.SourceBuild.Intermediate.*" /> | ||
|
||
<!-- This packages contain functionality that is executed in the build --> | ||
<UsagePattern IdentityGlob="Microsoft.Net.Compilers.Toolset/*" /> | ||
<UsagePattern IdentityGlob="System.Composition*/*" /> | ||
|
||
<!-- This is the version of Microsoft.CodeAnalysis used for tooling executed in repo source-build, | ||
as well as unit tests. --> | ||
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis*/*4.6.0-1.final*" /> | ||
<!-- Dependency of Microsoft.CodeAnalysis.Common 4.6.0-1.final --> | ||
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis.Analyzers/*3.3.4*" /> | ||
</IgnorePatterns> | ||
</UsageData> | ||
</UsageData> |
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
Oops, something went wrong.