Skip to content

Commit

Permalink
Merge branch 'release/6.0.1xx' of github.com:dotnet/roslyn-analyzers …
Browse files Browse the repository at this point in the history
…into idic-analyzer
  • Loading branch information
jkoritzinsky committed Jul 12, 2021
2 parents b0e6a52 + 1e2ab23 commit d558915
Show file tree
Hide file tree
Showing 264 changed files with 8,923 additions and 1,321 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ obj/
.dotnet/
.tools/
.packages/
temp/

# Per-user project properties
launchSettings.json
Expand Down
3 changes: 3 additions & 0 deletions Perf.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\perf\PerfCore.ps1""" %*"
exit /b %ErrorLevel%
51 changes: 51 additions & 0 deletions RoslynAnalyzers.sln
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28531.58
Expand Down Expand Up @@ -176,6 +177,24 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Resx
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests", "src\Microsoft.CodeAnalysis.ResxSourceGenerator\Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests\Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj", "{05BCDFF6-8B5B-4FF8-9239-3D42B580D8C8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PerformanceTests", "PerformanceTests", "{CE87A0B7-E19B-4230-A73C-60F6D65EB7DC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{43852421-59D7-4D63-977E-F862E1CF467D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReferenceAssemblies", "src\PerformanceTests\Utilities\ReferenceAssemblies\ReferenceAssemblies.csproj", "{382A7E99-4977-418C-B624-7ED7F7EE7914}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpPerfUtilities", "src\PerformanceTests\Utilities\CSharp\CSharpPerfUtilities.csproj", "{6A3B1816-97D3-4D30-8C6F-2F2DC288410B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommonPerfUtilities", "src\PerformanceTests\Utilities\Common\CommonPerfUtilities.csproj", "{8EC7A06A-01F2-49CF-9C45-4357AAD82546}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualBasicPerfUtilities", "src\PerformanceTests\Utilities\VisualBasic\VisualBasicPerfUtilities.csproj", "{8D764DDE-3762-4218-8BC4-CC1048095D5F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerformanceTests", "src\PerformanceTests\Tests\PerformanceTests.csproj", "{4FE82B4D-4AF1-4076-9E85-529205866A80}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfDiff", "src\Tools\PerfDiff\PerfDiff.csproj", "{AE549290-1702-4ECE-AE57-5FF4E85492C6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PerfDiff", "PerfDiff", "{BEE4B62A-86BD-4613-8F94-F40364350643}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Utilities\Workspaces\Workspaces.Utilities.projitems*{046419a7-c60d-40ff-ad7e-2bae461b7ce5}*SharedItemsImports = 5
Expand Down Expand Up @@ -460,6 +479,30 @@ Global
{05BCDFF6-8B5B-4FF8-9239-3D42B580D8C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05BCDFF6-8B5B-4FF8-9239-3D42B580D8C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05BCDFF6-8B5B-4FF8-9239-3D42B580D8C8}.Release|Any CPU.Build.0 = Release|Any CPU
{382A7E99-4977-418C-B624-7ED7F7EE7914}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{382A7E99-4977-418C-B624-7ED7F7EE7914}.Debug|Any CPU.Build.0 = Debug|Any CPU
{382A7E99-4977-418C-B624-7ED7F7EE7914}.Release|Any CPU.ActiveCfg = Release|Any CPU
{382A7E99-4977-418C-B624-7ED7F7EE7914}.Release|Any CPU.Build.0 = Release|Any CPU
{6A3B1816-97D3-4D30-8C6F-2F2DC288410B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A3B1816-97D3-4D30-8C6F-2F2DC288410B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A3B1816-97D3-4D30-8C6F-2F2DC288410B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A3B1816-97D3-4D30-8C6F-2F2DC288410B}.Release|Any CPU.Build.0 = Release|Any CPU
{8EC7A06A-01F2-49CF-9C45-4357AAD82546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EC7A06A-01F2-49CF-9C45-4357AAD82546}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EC7A06A-01F2-49CF-9C45-4357AAD82546}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EC7A06A-01F2-49CF-9C45-4357AAD82546}.Release|Any CPU.Build.0 = Release|Any CPU
{8D764DDE-3762-4218-8BC4-CC1048095D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D764DDE-3762-4218-8BC4-CC1048095D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D764DDE-3762-4218-8BC4-CC1048095D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D764DDE-3762-4218-8BC4-CC1048095D5F}.Release|Any CPU.Build.0 = Release|Any CPU
{4FE82B4D-4AF1-4076-9E85-529205866A80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FE82B4D-4AF1-4076-9E85-529205866A80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FE82B4D-4AF1-4076-9E85-529205866A80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FE82B4D-4AF1-4076-9E85-529205866A80}.Release|Any CPU.Build.0 = Release|Any CPU
{AE549290-1702-4ECE-AE57-5FF4E85492C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE549290-1702-4ECE-AE57-5FF4E85492C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE549290-1702-4ECE-AE57-5FF4E85492C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE549290-1702-4ECE-AE57-5FF4E85492C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -536,6 +579,14 @@ Global
{8701846B-5C49-4E45-9CB8-C3055BCCB025} = {DFD6F330-E9C5-413A-9B13-95BCC7824797}
{DDEB5C32-0758-42D7-854F-6B924557EE35} = {DFD6F330-E9C5-413A-9B13-95BCC7824797}
{05BCDFF6-8B5B-4FF8-9239-3D42B580D8C8} = {DFD6F330-E9C5-413A-9B13-95BCC7824797}
{43852421-59D7-4D63-977E-F862E1CF467D} = {CE87A0B7-E19B-4230-A73C-60F6D65EB7DC}
{382A7E99-4977-418C-B624-7ED7F7EE7914} = {43852421-59D7-4D63-977E-F862E1CF467D}
{6A3B1816-97D3-4D30-8C6F-2F2DC288410B} = {43852421-59D7-4D63-977E-F862E1CF467D}
{8EC7A06A-01F2-49CF-9C45-4357AAD82546} = {43852421-59D7-4D63-977E-F862E1CF467D}
{8D764DDE-3762-4218-8BC4-CC1048095D5F} = {43852421-59D7-4D63-977E-F862E1CF467D}
{4FE82B4D-4AF1-4076-9E85-529205866A80} = {CE87A0B7-E19B-4230-A73C-60F6D65EB7DC}
{AE549290-1702-4ECE-AE57-5FF4E85492C6} = {BEE4B62A-86BD-4613-8F94-F40364350643}
{BEE4B62A-86BD-4613-8F94-F40364350643} = {C0B86774-8307-444F-9EE4-98D62C3424F9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC44ACA9-AEA3-4EE6-881C-2E08ED281B5F}
Expand Down
12 changes: 7 additions & 5 deletions azure-pipelines-microbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
CreatePr: false
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-ROSANLZR'
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
MirrorRepo: roslyn-analyzers
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-ROSANLZR'
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
Expand All @@ -28,6 +29,7 @@ stages:
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enableTelemetry: true
enableSourceBuild: true
jobs:
- job: Signed_Build
pool:
Expand Down
40 changes: 40 additions & 0 deletions azure-pipelines-perf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Branches that trigger a build on commit
trigger:
- main
- release/*
- features/*
- 2.9.x

# Branch(es) that trigger(s) build(s) on PR
pr:
- main
- release/*
- features/*
- 2.9.x

jobs:
- job: Performance
strategy:
maxParallel: 4
matrix:
Release:
_configuration: Release
_codeCoverage: False
pool:
name: Hosted VS2017
queue: Windows.10.Amd64.20H2.Owl.Perf
timeoutInMinutes: 120

steps:
- checkout: self
clean: true
- pwsh: eng\perf\PerfCore.ps1 -v diag -diff -ci
displayName: Validate Performance
- task: PublishBuildArtifacts@1
displayName: Publish Performance Results
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts'
ArtifactName: 'Windows Performance Results'
continueOnError: true
condition: always()

2 changes: 2 additions & 0 deletions docs/Analyzer Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ End users can enable `.editorconfig` based configuration for individual document

Note that this additional file based approach is also supported on VS2019 16.3 and later releases for backwards compatibility.

**The additional file based approach is no longer supported starting in Microsoft.CodeAnalysis.NetAnalyzers v5.0.4. It will be implicitly discovered (if the file is in the project's directory or any ancestor directory), or it should be converted into a 'globalconfig'. See [Configuration files for code analysis rules](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-files).**

## Supported .editorconfig options

This section documents the list of supported `.editorconfig` key-value options for CA rules.
Expand Down
73 changes: 73 additions & 0 deletions docs/Performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Measuring Analyzer Performance

Now that analyzers are part of the build we need a mechanism to track their performance across releases as well as build confidence regarding their use in the SDK.

## Goals

- Developers can quickly get feedback on how their change affects performance
- We can track and detect performance regressions in builds before release.

## What we do today

- Roslyn
- Can be run on CI: **No**
- Can be run locally with a single script: **No**
- [Compiler Performance](https://github.com/dotnet/roslyn/blob/main/docs/wiki/Measuring-Compiler-Performance.md)
- compiler team has written scenarios in the dotnet/performance repo. The directions for these call for developers to clone the dotnet/performance repo and manually run the tests
- dotnet/performance benchmarks for roslyn are [here]((https://github.com/dotnet/performance/tree/main/src/benchmarks/real-world/Roslyn))
- [Analyzer Performance](https://microsoft.sharepoint.com/teams/managedlanguages/_layouts/15/Doc.aspx?sourcedoc={79b652be-6aa1-4feb-8d23-fa9127483ce9}&action=edit&wd=target%28Productivity%2FHelpers.one%7Caf49b9ef-72a4-4dee-9cf1-460fe552857a%2FHow%20to%20use%20AnalyzerRunner%7Cf8d125f1-83d6-47eb-8bde-09070142ceee%2F%29)
- There is an AnalyzerRunner commandline tool checked into dotnet/roslyn that can be used to run analyzers and validate their performance. It needs to be run in a manual fashion.
- [ASP.NET](https://github.com/aspnet/Benchmarks/blob/main/scenarios/README.md)
- Can be run on CI: **Yes**
- Can be run locally with a single script: **No**
- The ASP.NET team has written a tool (crank) that allows them to run benchmarks on either their local machines or remote machines using a client/server model. This does not require the user to download the dotnet/performance repository manually to run scenarios from there. Users will need to manually setup/patch runtimes with their changes but can then run them against the real benchmarks from there.
- [Crank](https://github.com/dotnet/crank)
- [TechEmpower Benchmarks Power BI](https://msit.powerbi.com/view?r=eyJrIjoiYTZjMTk3YjEtMzQ3Yi00NTI5LTg5ZDItNmUyMGRlOTkwMGRlIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9)
- Runtime
- Can be run on CI: **Yes** CI runs require you to submit a PR against dotnet/performance
- Can be run locally with a single script: **No**
- The runtime team has a set of benchmarking guides that detail how to run the tests in dotnet/performance against local changes.
- [Benchmarking](https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md)
- [Profiling](https://github.com/dotnet/performance/blob/main/docs/profiling-workflow-dotnet-runtime.md)

## Proposed Workflow

### Tests

We will have two types of tests:

#### Micro-Benchmarks

A set of micro-benchmarks (written in BenchmarkDotnet) testing how much time analyzers spend computing result. Each new analyzer that ships in the SDK is expected to have a micro-benchmark that tests

- code files that cause the analyzer to execute but not issue a diagnostic.
- code files that cause the analyzer to issue a diagnostic.

These tests are expected to live in the dotnet/roslyn-analyzers repo to make local development simpler.

#### End-to-End Tests

An end-to-end compilation test that measures how long the build takes on a large real-world project (based off existing scenarios [here](https://github.com/dotnet/performance/blob/main/docs/sdk-scenarios.md#sdk-build-throughput-scenario)). This test will be run twice, once with all muti-core build features disabled (no `/m` is passed to msbuild, and `/parallel-` is passed to the compiler) and once with the SDK defaults enabled. The reason we will want a test with no parallelism is to make it easier to see the source of regressions. These test will not just measure how long it takes analyzers to execute but the entire SDK-based build process. It will need to collect an ETL file for investigation as well as the following metrics in a binlog file

- How much time was spend in analysis (`/p:reportanalyzer=true`)
- How long each build task took (recorded by default in the binlog file)
- Total Build Time (recorded by default in the binlog file)

This test will be added to the dotnet/performance repo to augment the build throughput scenarios that are already there.

### Local Developer Machine

There will be a simple script that a developer can run locally on their machine that will compare their current changes to what is in `main`. The tests that will be run will be local to the dotnet/roslyn-analyzers repo. It will then produce a commandline result telling the developer if there is a regression (in typical benchmarkdotnet fashion) as well as an ETL file for both before and after that can be examined.

### For Pull Requests

The same script that the user ran locally will be executed on CI using the [results comparer](https://github.com/dotnet/performance/blob/main/src/tools/ResultsComparer/README.md) tool for BenchMarkDotNet to decide if the tests have passed. There are concerns about noise here. ResultsComparer has a noise threshold that can be set which we will adjust to the correct values over time. In addition, we can run these tests on a queue with "dedicated" hardware with the "Host" dnceng pool. We will need to evaluate carefully how noisy these results are, but the hope is that we can strike a good balance of giving developers feedback on the performance of their PRs (as well as traceability in the case of a regression) while also not kill code flow.

### Weekly Cadence

Our end-to-end performance tests are run and reported on the performance dashboard automatically. Once a week someone checks in on this performance board and verifies there are no negative trends. If a regression in build times appears to be trending a high priority bug is filed and acted on.

### For Releases

We run out end-to-end build performance tests and compare with the previous release
Example: We release .NET 6 Preview 7. CTI runs the performance tests on the this new release and compares to the results that were recorded for .NET 6 Preview 6 as well as the latest .NET 5 RTM. ***NOTE:*** The goal at this stage is to look at performance from a customer perspective. If there is not experiential change then we consider this change a pass.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21264.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21351.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>42de78a825b575a1ddeb73020a01fb8cd9311d09</Sha>
<Sha>7f52af24016a4b749a2c1f219105c0f5a7100028</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
</ToolsetDependencies>
Expand Down
21 changes: 15 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<VersionPrefix>3.3.3</VersionPrefix>
<PreReleaseVersionLabel>beta1</PreReleaseVersionLabel>
<NetAnalyzersVersionPrefix>6.0.0</NetAnalyzersVersionPrefix>
<NetAnalyzersPreReleaseVersionLabel>preview6</NetAnalyzersPreReleaseVersionLabel>
<NetAnalyzersPreReleaseVersionLabel>rc1</NetAnalyzersPreReleaseVersionLabel>
<AnalyzerUtilitiesVersionPrefix>$(VersionPrefix)</AnalyzerUtilitiesVersionPrefix>
<!--
When StabilizePackageVersion is set to 'true', this branch will produce stable outputs for 'Shipping' packages
Expand All @@ -16,7 +16,7 @@
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
<!-- Toolset -->
<MicrosoftVSSDKBuildToolsVersion>16.5.2044</MicrosoftVSSDKBuildToolsVersion>
<MicrosoftVSSDKBuildToolsVersion>16.9.1050</MicrosoftVSSDKBuildToolsVersion>
<MicrosoftVSSDKVSDConfigToolVersion>16.0.2032702</MicrosoftVSSDKVSDConfigToolVersion>
<CodecovVersion>1.12.3</CodecovVersion>
<CoverletVersion>2.9.0</CoverletVersion>
Expand All @@ -42,14 +42,23 @@
<!-- Roslyn Testing -->
<MicrosoftCodeAnalysisTestingVersion>1.0.1-beta1.21202.2</MicrosoftCodeAnalysisTestingVersion>
<!-- Libs -->
<BenchmarkDotNetVersion>0.13.0</BenchmarkDotNetVersion>
<HumanizerVersion>2.2.0</HumanizerVersion>
<MicrosoftBuildLocatorVersion>1.1.2</MicrosoftBuildLocatorVersion>
<MicrosoftDiagnosticsTracingTraceEventVersion>2.0.69</MicrosoftDiagnosticsTracingTraceEventVersion>
<MicrosoftExtensionsLoggingVersion>6.0.0-preview.5.21301.5</MicrosoftExtensionsLoggingVersion>
<MicrosoftNETCoreAppRefVersion>6.0.0-preview.4.21253.7</MicrosoftNETCoreAppRefVersion>
<MicrosoftVisualBasicVersion>10.1.0</MicrosoftVisualBasicVersion>
<MicrosoftVisualStudioCompositionVersion>16.1.8</MicrosoftVisualStudioCompositionVersion>
<NewtonsoftJsonVersion>12.0.1</NewtonsoftJsonVersion>
<PerfolizerVersion>0.2.1</PerfolizerVersion>
<SQLitePCLRawVersion>1.1.2</SQLitePCLRawVersion>
<SystemCollectionsImmutableVersion>1.3.1</SystemCollectionsImmutableVersion>
<SystemCommandLineRenderingVersion>2.0.0-beta1.20074.1</SystemCommandLineRenderingVersion>
<SystemCommandLineVersion>2.0.0-beta1.21216.1</SystemCommandLineVersion>
<SystemComponentModelCompositionVersion>4.7.0</SystemComponentModelCompositionVersion>
<SystemDirectoryServicesVersion>4.7.0</SystemDirectoryServicesVersion>
<SystemReflectionMetadataVersion>1.4.2</SystemReflectionMetadataVersion>
<MicrosoftVisualBasicVersion>10.1.0</MicrosoftVisualBasicVersion>
<MicrosoftBuildLocatorVersion>1.1.2</MicrosoftBuildLocatorVersion>
<SQLitePCLRawVersion>1.1.2</SQLitePCLRawVersion>
<HumanizerVersion>2.2.0</HumanizerVersion>
<XunitCombinatorialVersion>1.2.7</XunitCombinatorialVersion>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/common/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ case $cpuname in
;;
esac

dotnetRoot="$repo_root/.dotnet"
dotnetRoot="${repo_root}.dotnet"
if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then
dotnetRoot="$dotnetRoot/$architecture"
fi
Expand Down
Loading

0 comments on commit d558915

Please sign in to comment.