Skip to content

Commit 460ac2c

Browse files
authored
Merge pull request #59841 from dotnet/features/rename_ui_rework
2 parents 24d2825 + cacc9eb commit 460ac2c

File tree

113 files changed

+2722
-394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2722
-394
lines changed

.devcontainer/Dockerfile

+1-13
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
66

77
# Set up machine requirements to build the repo
88
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9-
&& apt-get -y install --no-install-recommends cmake llvm-9 clang-9 \
10-
build-essential python curl git lldb-6.0 liblldb-6.0-dev \
11-
libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev \
12-
libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja-build
13-
14-
# Install V8 Engine
15-
SHELL ["/bin/bash", "-c"]
16-
17-
RUN curl -sSL "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/chromium-v8/v8-linux64-rel-8.5.183.zip" -o ./v8.zip \
18-
&& unzip ./v8.zip -d /usr/local/v8 \
19-
&& echo $'#!/usr/bin/env bash\n\
20-
"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \
21-
&& chmod +x /usr/local/bin/v8
9+
&& apt-get -y install --no-install-recommends curl git

docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md

+8
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,11 @@ https://github.com/dotnet/roslyn/issues/57750
9898
public S() { Y = 0; } // ok
9999
}
100100
```
101+
102+
7. <a name="7"></a>Before Visual Studio 17.2, the C# compiler would accept incorrect default argument values involving a reference conversion of a string constant, and would emit `null` as the constant value instead of the default value specified in source. In Visual Studio 17.2, this becomes an error. See [roslyn#59806](https://github.com/dotnet/roslyn/pull/59806).
103+
104+
For instance, the following results in an error in 17.2:
105+
```csharp
106+
void M(IEnumerable<char> s = "hello")
107+
```
108+

docs/contributing/Compiler Test Plan.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ This document provides guidance for thinking about language interactions and tes
22

33
# General concerns:
44
- Completeness of the specification as a guide for testing (is the spec complete enough to suggest what the compiler should do in each scenario?)
5-
- Other external documentation
5+
- *Ping* for new breaking changes and general ping for partner teams (Bill, Kathleen, Mads, IDE, Razor)
6+
- Help review external documentation
67
- Backward and forward compatibility (interoperation with previous and future compilers, each in both directions)
78
- Error handling/recovery (missing libraries, including missing types in mscorlib; errors in parsing, ambiguous lookup, inaccessible lookup, wrong kind of thing found, instance vs static thing found, wrong type for the context, value vs variable)
89
- BCL (including mono) and other customer impact

eng/Versions.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<MajorVersion>4</MajorVersion>
99
<MinorVersion>2</MinorVersion>
1010
<PatchVersion>0</PatchVersion>
11-
<PreReleaseVersionLabel>2</PreReleaseVersionLabel>
11+
<PreReleaseVersionLabel>3</PreReleaseVersionLabel>
1212
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
1313
<!--
1414
By default the assembly version in official builds is "$(MajorVersion).$(MinorVersion).0.0".

eng/config/PublishData.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@
220220
"version": "4.2.*",
221221
"packageFeeds": "default",
222222
"channels": [],
223-
"vsBranch": "rel/d17.2",
223+
"vsBranch": "main",
224224
"vsMajorVersion": 17,
225-
"insertionTitlePrefix": "[d17.2p1]"
225+
"insertionTitlePrefix": "[d17.2p2]"
226226
},
227227
"main": {
228228
"nugetKind": [
@@ -234,8 +234,8 @@
234234
"channels": [],
235235
"vsBranch": "main",
236236
"vsMajorVersion": 17,
237-
"insertionCreateDraftPR": false,
238-
"insertionTitlePrefix": "[d17.2p2]"
237+
"insertionCreateDraftPR": true,
238+
"insertionTitlePrefix": "[d17.2p3]"
239239
},
240240
"features/NullableReferenceTypes": {
241241
"nugetKind": "PerBuildPreRelease",

eng/pipelines/test-integration-job.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ steps:
4747
condition: not(succeeded())
4848

4949
- task: PublishBuildArtifacts@1
50-
displayName: Publish Screenshots
50+
displayName: Publish Screenshots and Test Attachments
5151
inputs:
52-
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\${{ parameters.configuration }}\net472\xUnitResults'
52+
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\${{ parameters.configuration }}\net472\TestResults'
5353
ArtifactName: '$(System.JobAttempt)-Screenshots ${{ parameters.configuration }} OOP64_${{ parameters.oop64bit }} OOPCoreClr_${{ parameters.oopCoreClr }} LspEditor_${{ parameters.lspEditor }} $(Build.BuildNumber)'
5454
publishLocation: Container
5555
continueOnError: true

src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<Compile Include="$(MSBuildThisFileDirectory)SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs" />
4545
<Compile Include="$(MSBuildThisFileDirectory)SimplifyLinqExpression\CSharpSimplifyLinqExpressionCodeFixProvider.cs" />
4646
<Compile Include="$(MSBuildThisFileDirectory)SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs" />
47+
<Compile Include="$(MSBuildThisFileDirectory)TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs" />
4748
<Compile Include="$(MSBuildThisFileDirectory)UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs" />
4849
<Compile Include="$(MSBuildThisFileDirectory)UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs" />
4950
<Compile Include="$(MSBuildThisFileDirectory)UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs" />
@@ -79,7 +80,4 @@
7980
<ItemGroup Condition="'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'">
8081
<ExpectedCompile Include="$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)" />
8182
</ItemGroup>
82-
<ItemGroup>
83-
<Folder Include="$(MSBuildThisFileDirectory)ConvertNamespace\" />
84-
</ItemGroup>
8583
</Project>

src/Analyzers/CSharp/CodeFixes/CSharpCodeFixesResources.resx

+3
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,7 @@
144144
<data name="Place_colon_on_following_line" xml:space="preserve">
145145
<value>Place colon on following line</value>
146146
</data>
147+
<data name="Fix_record_declaration" xml:space="preserve">
148+
<value>Fix_record_declaration</value>
149+
</data>
147150
</root>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.Collections.Immutable;
7+
using System.Composition;
8+
using System.Diagnostics.CodeAnalysis;
9+
using System.Linq;
10+
using System.Threading;
11+
using System.Threading.Tasks;
12+
using Microsoft.CodeAnalysis.CodeActions;
13+
using Microsoft.CodeAnalysis.CodeFixes;
14+
using Microsoft.CodeAnalysis.CSharp.Syntax;
15+
using Microsoft.CodeAnalysis.Editing;
16+
using Microsoft.CodeAnalysis.Host.Mef;
17+
using Microsoft.CodeAnalysis.Shared.Extensions;
18+
19+
namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword
20+
{
21+
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.TransposeRecordKeyword), Shared]
22+
internal class CSharpTransposeRecordKeywordCodeFixProvider : SyntaxEditorBasedCodeFixProvider
23+
{
24+
private const string CS9012 = nameof(CS9012); // Unexpected keyword 'record'. Did you mean 'record struct' or 'record class'?
25+
26+
[ImportingConstructor]
27+
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
28+
public CSharpTransposeRecordKeywordCodeFixProvider()
29+
{
30+
}
31+
32+
public override ImmutableArray<string> FixableDiagnosticIds
33+
=> ImmutableArray.Create(CS9012);
34+
35+
internal override CodeFixCategory CodeFixCategory
36+
=> CodeFixCategory.Compile;
37+
38+
private static bool TryGetRecordDeclaration(
39+
Diagnostic diagnostic, CancellationToken cancellationToken, [NotNullWhen(true)] out RecordDeclarationSyntax? recordDeclaration)
40+
{
41+
recordDeclaration = diagnostic.Location.FindNode(cancellationToken) as RecordDeclarationSyntax;
42+
return recordDeclaration != null;
43+
}
44+
45+
private static bool TryGetTokens(
46+
RecordDeclarationSyntax recordDeclaration,
47+
out SyntaxToken classOrStructKeyword,
48+
out SyntaxToken recordKeyword)
49+
{
50+
recordKeyword = recordDeclaration.Keyword;
51+
if (!recordKeyword.IsMissing)
52+
{
53+
var leadingTrivia = recordKeyword.LeadingTrivia;
54+
var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia);
55+
if (skippedTriviaIndex >= 0)
56+
{
57+
var skippedTrivia = leadingTrivia[skippedTriviaIndex];
58+
var structure = (SkippedTokensTriviaSyntax)skippedTrivia.GetStructure()!;
59+
var tokens = structure.Tokens;
60+
if (tokens.Count == 1)
61+
{
62+
classOrStructKeyword = tokens.Single();
63+
if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword)
64+
{
65+
// Because the class/struct keyword is skipped trivia on the record keyword, it will
66+
// not have trivia of it's own. So we need to move the other trivia appropriate trivia
67+
// on the record keyword to it.
68+
var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1));
69+
var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
70+
? eolIndex + 1
71+
: remainingLeadingTrivia.Count;
72+
73+
classOrStructKeyword = classOrStructKeyword
74+
.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil)))
75+
.WithTrailingTrivia(recordKeyword.TrailingTrivia);
76+
recordKeyword = recordKeyword
77+
.WithLeadingTrivia(leadingTrivia.Take(skippedTriviaIndex))
78+
.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));
79+
80+
return true;
81+
}
82+
}
83+
}
84+
}
85+
86+
classOrStructKeyword = default;
87+
return false;
88+
}
89+
90+
public override Task RegisterCodeFixesAsync(CodeFixContext context)
91+
{
92+
var document = context.Document;
93+
var cancellationToken = context.CancellationToken;
94+
95+
var diagnostic = context.Diagnostics.First();
96+
if (TryGetRecordDeclaration(diagnostic, cancellationToken, out var recordDeclaration) &&
97+
TryGetTokens(recordDeclaration, out _, out _))
98+
{
99+
context.RegisterCodeFix(
100+
new MyCodeAction(c => this.FixAsync(document, diagnostic, c)),
101+
diagnostic);
102+
}
103+
104+
return Task.CompletedTask;
105+
}
106+
107+
protected override Task FixAllAsync(
108+
Document document, ImmutableArray<Diagnostic> diagnostics,
109+
SyntaxEditor editor, CancellationToken cancellationToken)
110+
{
111+
foreach (var diagnostic in diagnostics)
112+
{
113+
if (TryGetRecordDeclaration(diagnostic, cancellationToken, out var recordDeclaration))
114+
{
115+
editor.ReplaceNode(
116+
recordDeclaration,
117+
(current, _) =>
118+
{
119+
var currentRecordDeclaration = (RecordDeclarationSyntax)current;
120+
if (!TryGetTokens(currentRecordDeclaration, out var classOrStructKeyword, out var recordKeyword))
121+
return currentRecordDeclaration;
122+
123+
return currentRecordDeclaration
124+
.WithClassOrStructKeyword(classOrStructKeyword)
125+
.WithKeyword(recordKeyword);
126+
});
127+
}
128+
}
129+
130+
return Task.CompletedTask;
131+
}
132+
133+
private class MyCodeAction : CustomCodeActions.DocumentChangeAction
134+
{
135+
public MyCodeAction(
136+
Func<CancellationToken, Task<Document>> createChangedDocument)
137+
: base(CSharpCodeFixesResources.Fix_record_declaration, createChangedDocument, nameof(CSharpTransposeRecordKeywordCodeFixProvider))
138+
{
139+
}
140+
}
141+
}
142+
}

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.cs.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.de.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.es.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.fr.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.it.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ja.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ko.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pl.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pt-BR.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ru.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.tr.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hans.xlf

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)