Skip to content

Commit

Permalink
Merge pull request dotnet#49225 from dotnet/merges/master-to-features…
Browse files Browse the repository at this point in the history
…/interpolated-string-constants

Merge master to features/interpolated-string-constants
  • Loading branch information
msftbot[bot] authored Nov 8, 2020
2 parents 48b5573 + a8d9b86 commit 6a85958
Show file tree
Hide file tree
Showing 384 changed files with 9,415 additions and 5,201 deletions.
5 changes: 3 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ src/CodeStyle/ @dotnet/roslyn-ide
src/Compilers/ @dotnet/roslyn-compiler
src/EditorFeatures/ @dotnet/roslyn-ide

# If we touch the WPF layer, let the VS for Mac team have an opportunity to sign-off. Any changes made here
# may also have to be reflected into the EditorFeatures.Cocoa library which doesn't live in this repository.
# If we touch the WPF layer or Cocoa layers, the VS for Mac team also should take a look. We do this even if it's
# only touching WPF since the change might also need to be made (and validated) on the Cocoa side of things.
src/EditorFeatures/Core.Cocoa/ @dotnet/roslyn-ide @dotnet/roslyn-vs-for-mac
src/EditorFeatures/Core.Wpf/ @dotnet/roslyn-ide @dotnet/roslyn-vs-for-mac
src/EditorFeatures/CSharp.Wpf/ @dotnet/roslyn-ide @dotnet/roslyn-vs-for-mac

Expand Down
11 changes: 1 addition & 10 deletions azure-pipelines-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
displayName: Build and Test
inputs:
filePath: eng/build.ps1
arguments: -ci -restore -build -pack -sign -publish -binaryLog -configuration $(_configuration) -prepareMachine -testVsi -oop64bit:$$(_oop64bit) -procdump
arguments: -ci -restore -build -pack -sign -publish -binaryLog -configuration $(_configuration) -prepareMachine -testVsi -oop64bit:$$(_oop64bit) -collectDumps

- task: PublishTestResults@2
displayName: Publish xUnit Test Results
Expand All @@ -61,15 +61,6 @@ jobs:
continueOnError: true
condition: not(succeeded())

- task: PublishBuildArtifacts@1
displayName: Publish Secondary Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log2\$(_configuration)'
ArtifactName: '$(System.JobAttempt)-Secondary Logs $(_configuration) OOP64_$(_oop64bit) $(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())

- task: PublishBuildArtifacts@1
displayName: Publish Screenshots
inputs:
Expand Down
12 changes: 12 additions & 0 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ stages:
arguments: '-sourceBranchName $(SourceBranchName) -prNumber $(PRNumber)'
condition: and(succeeded(), ne(variables['PRNumber'], 'default'))

- task: tagBuildOrRelease@0
displayName: Tag master validation build
inputs:
type: 'Build'
tags: |
MasterValidationBuild
condition: and(succeeded(), eq(variables['SourceBranchName'], 'master'))

- powershell: git pull origin master-vs-deps
displayName: Merge master-vs-deps into source branch
condition: and(succeeded(), eq(variables['SourceBranchName'], 'master'))

- powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranchName)/$(Build.BuildNumber)"
displayName: Setting VisualStudio.DropName variable

Expand Down
14 changes: 7 additions & 7 deletions docs/analyzers/FixAllProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Selecting an Equivalence key for code actions
Each unique equivalence key for a code fixer defines a unique equivalence class of code actions. Equivalence key of the trigger code action is part of the `FixAllContext` and is used to determine the FixAll occurrences code fix.
Normally, you can use the **'title'** of the code action as the equivalence key. However, there are cases where you may desire to have different values. Let us take an example to get a better understanding.

Let us consider the [C# SimplifyTypeNamesCodeFixProvider](http://source.roslyn.io/#q=Microsoft.CodeAnalysis.CSharp.CodeFixes.SimplifyTypeNames.SimplifyTypeNamesCodeFixProvider) that registers multiple code actions and also has FixAll support. This code fixer offers fixes to simplify the following expressions:
Let us consider the [C# SimplifyTypeNamesCodeFixProvider](https://github.com/dotnet/roslyn/blob/master/src/Features/CSharp/Portable/SimplifyTypeNames/SimplifyTypeNamesCodeFixProvider.cs) that registers multiple code actions and also has FixAll support. This code fixer offers fixes to simplify the following expressions:
- `this` expressions of the form 'this.x' to 'x'.
- Qualified type names of the form 'A.B' to 'B'.
- Member access expressions of the form 'A.M' to 'M'.
Expand All @@ -64,22 +64,22 @@ This fixer needs the following semantics for the corresponding FixAll occurrence
- Qualified type name simplification: Fix all should simplify all qualified type names 'A.B' to 'B'. However, we don't want to simplify **all** qualified type names, such as 'C.D', 'E.F', etc. as that would be too generic a fix, which is not likely intended by the user.
- Member access expressions: Fix all should simplify all member access expressions 'A.M' to 'M'.

It uses the below equivalence keys for it's registered code actions to get the desired FixAll behavior:
It uses the below equivalence keys for its registered code actions to get the desired FixAll behavior:
- `this` expression simplification: Generic resource string "Simplify this expression", which explicitly excludes the contents of the node being simplified.
- Qualified type name simplification: Formatted resource string "Simplify type name A.B", which explicitly includes the contents of the node being simplified.
- Member access expressions: Formatted resource string "Simplify type name A.M", which explicitly includes the contents of the node being simplified.

Note that '`this` expression simplification' fix requires a different kind of an equivalence class from the other two simplifications. See method [GetCodeActionId](http://source.roslyn.io/Microsoft.CodeAnalysis.CSharp.Features/R/917a728e9783562f.html) for the actual implementation.
Note that '`this` expression simplification' fix requires a different kind of an equivalence class from the other two simplifications. See method [GetCodeActionId](https://github.com/dotnet/roslyn/blob/master/src/Features/Core/Portable/ImplementAbstractClass/AbstractImplementAbstractClassCodeFixProvider.cs) for the actual implementation.

To summarize, use the equivalence key that best suits the category of fixes to be applied as part of a FixAll operation.

Spectrum of FixAll providers
============================

When multiple fixes need to be applied to documents, there are various way to do it:
- **Sequential approach**: One way to do it is to compute diagnostics, pick one, ask a fixer to produce a code action to fix that, apply it. Now for the resulting new compilation, recomputed diagnostics, pick the next one and repeat the process. This approach would be very slow but would lead to correct results (unless it doesn't converge where one fix introduces a diagnostic that was just fixed by a previous fix). We chose to not implement this approach.
- **Batch fix approach** - Another way to do this to compute all the diagnostics, pick each diagnostic and give it to a fixer to and ask it apply it to produce a new solution. If there were 'n' diagnostics, there would be 'n' new solutions. Now just merge them all together in one go. This may produce incorrect results (when different fixes change the same region of code in different ways) but it is very fast. We have one implementation of this approach in `WellKnownFixAllProviders.BatchFixer`
- **Custom approach** - Depending on the fix, there may be a custom solution to fix multiple issues. For example, consider an analyzer that simply needs to generate one file as the fix for any instance of the issue. Instead of generating the same file over and over using the previous two approaches, one could write a custom `FixAllProvider` that simply generates the file once if there were any diagnostics at all.
When multiple fixes need to be applied to documents, there are various ways to do it:
- **Sequential approach**: One way to do it is to compute diagnostics, pick one, ask a fixer to produce a code action to fix that, apply it. Now for the resulting new compilation, recompute diagnostics, pick the next one and repeat the process. This approach would be very slow but would lead to correct results (unless it doesn't converge where one fix introduces a diagnostic that was just fixed by a previous fix). We chose to not implement this approach.
- **Batch fix approach**: Another way is to compute all the diagnostics, pick each diagnostic and give it to a fixer and apply it to produce a new solution. If there were 'n' diagnostics, there would be 'n' new solutions. Now just merge them all together in one go. This may produce incorrect results (when different fixes change the same region of code in different ways) but it is very fast. We have one implementation of this approach in `WellKnownFixAllProviders.BatchFixer`
- **Custom approach**: Depending on the fix, there may be a custom solution to fix multiple issues. For example, consider an analyzer that simply needs to generate one file as the fix for any instance of the issue. Instead of generating the same file over and over using the previous two approaches, one could write a custom `FixAllProvider` that simply generates the file once if there were any diagnostics at all.

Since there are various ways of fixing all issues, we've implemented a framework and provided the one general implementation that we think is useful in many cases.

Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4f384ab6a49fc642aec2acc4bcc938172a0744d1</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.9.0-2.20526.2">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.9.0-2.20552.2">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>1380b7dc11c2eb3725fef3409ef7167fb7d543a2</Sha>
<Sha>a76ac7f4039ac1e240f7807fe8a350a2ba5b9ad7</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</MajorVersion>
<MinorVersion>
</MinorVersion>
<MicrosoftNetCompilersToolsetVersion>3.9.0-2.20526.2</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>3.9.0-2.20552.2</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
Expand Down
24 changes: 9 additions & 15 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ param (
[switch][Alias('bl')]$binaryLog,
[switch]$buildServerLog,
[switch]$ci,
[switch]$procdump,
[switch]$collectDumps,
[switch][Alias('a')]$runAnalyzers,
[switch][Alias('d')]$deployExtensions,
[switch]$prepareMachine,
Expand Down Expand Up @@ -98,7 +98,7 @@ function Print-Usage() {
Write-Host " -bootstrap Build using a bootstrap compilers"
Write-Host " -bootstrapConfiguration Build configuration for bootstrap compiler: 'Debug' or 'Release'"
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
Write-Host " -procdump Monitor test runs with procdump"
Write-Host " -collectDumps Collect dumps from test runs"
Write-Host " -runAnalyzers Run analyzers during build operations (short: -a)"
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -useGlobalNuGetCache Use global NuGet cache."
Expand Down Expand Up @@ -151,7 +151,7 @@ function Process-Arguments() {

if ($officialBuildId) {
$script:useGlobalNuGetCache = $false
$script:procdump = $true
$script:collectDumps = $true
$script:testDesktop = ![System.Boolean]::Parse($officialSkipTests)
$script:applyOptimizationData = ![System.Boolean]::Parse($officialSkipApplyOptimizationData)
} else {
Expand Down Expand Up @@ -328,21 +328,13 @@ function TestUsingOptimizedRunner() {
# Minimize all windows to avoid interference during integration test runs
$shell = New-Object -ComObject "Shell.Application"
$shell.MinimizeAll()

# Set registry to take dump automatically when test process crashes
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /f /v DumpType /t REG_DWORD /d 2
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /f /v DumpCount /t REG_DWORD /d 2
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /f /v DumpFolder /t REG_SZ /d "$LogDir"
}
}

if ($testIOperation) {
$env:ROSLYN_TEST_IOPERATION = "true"
}

$secondaryLogDir = Join-Path (Join-Path $ArtifactsDir "log2") $configuration
Create-Directory $secondaryLogDir
$testResultsDir = Join-Path $ArtifactsDir "TestResults\$configuration"
$binDir = Join-Path $ArtifactsDir "bin"
$runTests = GetProjectOutputBinary "RunTests.exe"
Expand All @@ -356,7 +348,6 @@ function TestUsingOptimizedRunner() {
$args += " --dotnet `"$dotnetExe`""
$args += " --out `"$testResultsDir`""
$args += " --logs `"$LogDir`""
$args += " --secondarylogs `"$secondaryLogDir`""
$args += " --tfm net472"

if ($testDesktop -or $testIOperation) {
Expand All @@ -374,7 +365,7 @@ function TestUsingOptimizedRunner() {
}

$dlls += @(Get-ChildItem -Recurse -Include "*.IntegrationTests.dll" $binDir)
$args += " --testVsi"
$args += " --testvsi"
} else {
$dlls = Get-ChildItem -Recurse -Include "*.IntegrationTests.dll" $binDir
$args += " --trait:Feature=NetCore"
Expand Down Expand Up @@ -403,11 +394,14 @@ function TestUsingOptimizedRunner() {
$args += " --timeout 90"
}
}
else {
$args += " --html"
}

if ($procdump) {
if ($collectDumps) {
$procdumpFilePath = Ensure-ProcDump
$args += " --procdumppath $procDumpFilePath"
$args += " --useprocdump";
$args += " --collectdumps";
}

if ($test64) {
Expand Down
99 changes: 99 additions & 0 deletions eng/config/globalconfigs/Common.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
is_global = true

dotnet_diagnostic.CA1067.severity = warning
dotnet_diagnostic.CA1068.severity = warning
dotnet_diagnostic.CA1200.severity = warning
dotnet_diagnostic.CA1821.severity = warning

dotnet_diagnostic.IDE0055.severity = warning

dotnet_diagnostic.RS1001.severity = none
dotnet_diagnostic.RS1002.severity = none
dotnet_diagnostic.RS1003.severity = none
dotnet_diagnostic.RS1004.severity = none
dotnet_diagnostic.RS1005.severity = none
dotnet_diagnostic.RS1006.severity = none
dotnet_diagnostic.RS1008.severity = none
dotnet_diagnostic.RS1009.severity = none
dotnet_diagnostic.RS1010.severity = none
dotnet_diagnostic.RS1011.severity = none
dotnet_diagnostic.RS1012.severity = none
dotnet_diagnostic.RS1013.severity = none
dotnet_diagnostic.RS1014.severity = warning
# https://github.com/dotnet/roslyn/issues/26420: Enable rule RS1022 for Roslyn.sln
dotnet_diagnostic.RS1022.severity = none
# RS1024: Compare symbols correctly
dotnet_diagnostic.RS1024.severity = refactoring

dotnet_diagnostic.AD0001.severity = error

dotnet_diagnostic.RS0001.severity = warning
dotnet_diagnostic.RS0002.severity = warning
dotnet_diagnostic.RS0006.severity = error
dotnet_diagnostic.RS0012.severity = warning
dotnet_diagnostic.RS0014.severity = warning
dotnet_diagnostic.RS0015.severity = warning
dotnet_diagnostic.RS0016.severity = error
dotnet_diagnostic.RS0017.severity = error
dotnet_diagnostic.RS0018.severity = warning
dotnet_diagnostic.RS0022.severity = error
dotnet_diagnostic.RS0023.severity = error
dotnet_diagnostic.RS0024.severity = error
dotnet_diagnostic.RS0025.severity = error
dotnet_diagnostic.RS0026.severity = error
dotnet_diagnostic.RS0027.severity = error
# RS0040: Defaultable types should have defaultable fields
dotnet_diagnostic.RS0040.severity = none
# RS0046: Avoid the 'Opt' suffix in nullable-enabled code (too noisy right now)
dotnet_diagnostic.RS0046.severity = suggestion
# RS0047: (Suppressor) The 'Type.FullName' property is never null when using the syntax 'typeof(T).FullName'
dotnet_diagnostic.RS0047.severity = none

# allow skipped tests, with a code fix to unskip them
dotnet_diagnostic.xUnit1004.severity = refactoring
# xUnit2006: "do not use generic Assert.Equal to test string equality" is a valid assert, but very noisy right now
dotnet_diagnostic.xUnit2006.severity = none
# xUnit2009: "do not use Assert.True to check for substrings" is a valid assert, but very noisy right now
dotnet_diagnostic.xUnit2009.severity = none
# xUnit2012: "do not use Enumerable.Any() to check if a value exists in a collection" is a valid assert, but very noisy right now
dotnet_diagnostic.xUnit2012.severity = none
# xUnit2013: "do not use Assert.Equal() to check for collection size" is a valid assert, but very noisy right now
dotnet_diagnostic.xUnit2013.severity = none
# xUnit2017: "do not use Contains() to check if a value exists in a collection" is a valid assert, but very noisy right now
dotnet_diagnostic.xUnit2017.severity = none

# https://github.com/Microsoft/VSSDK-Analyzers/blob/master/doc/index.md
# VSSDK001: Derive from AsyncPackage
dotnet_diagnostic.VSSDK001.severity = warning
# VSSDK003: Support async tool windows
dotnet_diagnostic.VSSDK003.severity = warning
# VSSDK006: Remove suppression. https://github.com/dotnet/roslyn/issues/38471
dotnet_diagnostic.VSSDK006.severity = none

# VSTHRD002: Avoid problematic synchronous waits
dotnet_diagnostic.VSTHRD002.severity = none
# VSTHRD003: Avoid awaiting foreign Tasks https://github.com/dotnet/roslyn/issues/34331
dotnet_diagnostic.VSTHRD003.severity = none
# VSTHRD103: Call async methods when in an async method
dotnet_diagnostic.VSTHRD103.severity = none
# VSTHRD010: Invoke single-threaded types on Main thread https://github.com/dotnet/roslyn/issues/29275
dotnet_diagnostic.VSTHRD010.severity = none
# VSTHRD110: Observe result of async calls
dotnet_diagnostic.VSTHRD110.severity = none

dotnet_diagnostic.HAA0101.severity = none
dotnet_diagnostic.HAA0102.severity = none
dotnet_diagnostic.HAA0201.severity = none
dotnet_diagnostic.HAA0202.severity = none
dotnet_diagnostic.HAA0301.severity = none
dotnet_diagnostic.HAA0302.severity = none
dotnet_diagnostic.HAA0303.severity = none
dotnet_diagnostic.HAA0401.severity = none
dotnet_diagnostic.HAA0501.severity = none
dotnet_diagnostic.HAA0502.severity = none
dotnet_diagnostic.HAA0503.severity = none
dotnet_diagnostic.HAA0506.severity = none
dotnet_diagnostic.HAA0601.severity = none
dotnet_diagnostic.HAA0602.severity = none
dotnet_diagnostic.HAA0603.severity = none
dotnet_diagnostic.HeapAnalyzerReadonlyMethodGroupAllocationRule.severity = none
25 changes: 25 additions & 0 deletions eng/config/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
is_global = true

# For tests, the ConfigureAwait(true) is good enough. Either they are already running on a thread pool
# thread where ConfigureAwait(false) does nothing, or we're running the workload from an STA thread
# where we want to marshal the continuations back to it.
dotnet_diagnostic.CA2007.severity = none

# Mark constant field as 'const' instead of static readonly - not useful for tests
dotnet_diagnostic.CA1802.severity = none

# CodeFix providers should override GetFixAllProvider - suppress for non-shipping/test projects
dotnet_diagnostic.RS1016.severity = none
# DiagnosticId must be unique across analyzers - suppress for non-shipping/test projects
dotnet_diagnostic.RS1019.severity = none
# Configure generated code analysis - suppress for non-shipping/test projects
dotnet_diagnostic.RS1025.severity = none
# Enable concurrent execution - suppress for non-shipping/test projects
dotnet_diagnostic.RS1026.severity = none
# Do not use generic CodeAction.Create to create CodeAction - not useful for tests
dotnet_diagnostic.RS0005.severity = none
# Do not call 'GetTestAccessor()' from production code: does not apply to tests
dotnet_diagnostic.RS0043.severity = none

# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.VSTHRD200.severity = none
6 changes: 6 additions & 0 deletions eng/config/globalconfigs/Shipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
is_global = true

dotnet_diagnostic.CA1802.severity = warning
dotnet_diagnostic.CA2007.severity = warning

dotnet_diagnostic.RS0005.severity = warning
Loading

0 comments on commit 6a85958

Please sign in to comment.