Skip to content

Commit

Permalink
Merge branch 'main' into lsp_stj
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet authored May 15, 2024
2 parents cade388 + a26bed7 commit c1fd7b3
Show file tree
Hide file tree
Showing 578 changed files with 14,115 additions and 13,440 deletions.
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@
},
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "build language server",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"-c",
"Debug",
"src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj"
],
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "launch vscode with language server",
"command": "${execPath}",
"type": "process",
"options": {
"env": {
"DOTNET_ROSLYN_SERVER_PATH": "${workspaceRoot}/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer/Debug/net8.0/Microsoft.CodeAnalysis.LanguageServer.dll"
}
},
"dependsOn": [ "build language server" ]
}
]
}
2 changes: 2 additions & 0 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ variables:
- name: ArtifactServices.Drop.PAT
value: $(dn-bot-devdiv-drop-rw-code-rw)
- group: DotNet-Roslyn-Insertion-Variables
- group: AzureDevOps-Artifact-Feeds-Pats

- name: BuildConfiguration
value: release
Expand Down Expand Up @@ -149,6 +150,7 @@ extends:
dropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
dropName: $(VisualStudio.DropName)
accessToken: $(_DevDivDropAccessToken)
dropRetentionDays: 90

# Publish insertion packages to CoreXT store.
- output: nuget
Expand Down
1 change: 1 addition & 0 deletions docs/Language Feature Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ efforts behind them.

| Feature | Branch | State | Developer | Reviewer | IDE Buddy | LDM Champ |
| ------- | ------ | ----- | --------- | -------- | --------- | --------- |
| [First-class Span Types](https://github.com/dotnet/csharplang/issues/7905) | [FirstClassSpan](https://github.com/dotnet/roslyn/tree/features/FirstClassSpan) | [In Progress](https://github.com/dotnet/roslyn/issues/73445) | [jjonescz](https://github.com/jjonescz) | [cston](https://github.com/cston), [333fred](https://github.com/333fred) | | [333fred](https://github.com/333fred), [stephentoub](https://github.com/stephentoub) |
| [Partial properties](https://github.com/dotnet/csharplang/issues/6420) | [partial-properties](https://github.com/dotnet/roslyn/tree/features/partial-properties) | [In Progress](https://github.com/dotnet/roslyn/issues/73090) | [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv), [333fred](https://github.com/333fred) | [Cosifne](https://github.com/Cosifne) | [333fred](https://github.com/333fred), [RikkiGibson](https://github.com/RikkiGibson) |
| Ref/unsafe in iterators/async | [RefInAsync](https://github.com/dotnet/roslyn/tree/features/RefInAsync) | [In Progress](https://github.com/dotnet/roslyn/issues/72662) | [jjonescz](https://github.com/jjonescz) | [AlekseyTs](https://github.com/AlekseyTs), [cston](https://github.com/cston) | (no IDE impact) | |
| [Ref Struct Interfaces](https://github.com/dotnet/csharplang/issues/7608) | [RefStructInterfaces](https://github.com/dotnet/roslyn/tree/features/RefStructInterfaces) | [In Progress](https://github.com/dotnet/roslyn/issues/72124) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [jjonescz](https://github.com/jjonescz) | [ToddGrun](https://github.com/ToddGrun) | [agocke](https://github.com/agocke), [jaredpar](https://github.com/jaredpar) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Particularly for developers who aren't experienced with .NET Core development on
1. Install the [.NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
3. You can build from VS Code by running the *Run Build Task* command, then selecting an appropriate task such as *build* or *build current project* (the latter builds the containing project for the current file you're viewing in the editor).
4. You can run tests from VS Code by opening a test class in the editor, then using the *Run Tests in Context* and *Debug Tests in Context* editor commands. You may want to bind these commands to keyboard shortcuts that match their Visual Studio equivalents (**Ctrl+R, T** for *Run Tests in Context* and **Ctrl+R, Ctrl+T** for *Debug Tests in Context*).
5. You can launch a new VS Code instance with the language server from your current code by running the "launch vscode with language server" task.

## Running Tests
The unit tests can be executed by running `./build.sh --test`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ give it a try.
### Deploying with command-line (recommended method)

You can build and deploy with the following command:
`.\Build.cmd -Configuration Release -deployExtensions -launch`.
`.\Build.cmd -Restore -Configuration Release -deployExtensions -launch`.

Then you can launch the `RoslynDev` hive with `devenv /rootSuffix RoslynDev`.

Expand Down
21 changes: 21 additions & 0 deletions docs/wiki/EnC-Supported-Edits.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,24 @@ This document captures the current state. Potential future improvements in this
| Edit a member referencing an embedded interop type | - |
| Edit a member with On Error or Resume statements | Specific to Visual Basic |
| Edit a member containing an Aggregate, Group By, Simple Join, or Group Join LINQ query clause | Specific to Visual Basic |
| Edit in a solution containing projects that specify `*` in `AssemblyVersionAttribute`, e.g. `[assembly: AssemblyVersion("1.0.*")`]. | See [workaround](#projects-with-variable-assembly-versions) below. |

### Projects with variable assembly versions

Hot Reload and Edit & Continue are not compatible with using `*` in `AssemblyVersionAttribute` value. Presence of `*` in the version means that the compiler generates a new version
every build based on the current time. The build then produces non-reproducible, non-deterministic outputs (see [Reproducible Builds](https://reproducible-builds.org)).

It is thus highly recommended to use alternative versioning methods, such as [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning), that derive the assembly version
from the HEAD commit SHA (for git repositories).

> To enable generating commit SHA based assembly versions using `Nerdbank.GitVersioning` package, specify `{ "assemblyVersion" : {"precision": "revision"} }` setting in `version.json`.
If you prefer to keep using `*` in `AssemblyVersionAttribute` it is recommended to use conditional compilation directive to only apply such version to Release builds like so:

```C#
#if DEBUG
[assembly: AssemblyVersion("1.0.0.0")]
#else
[assembly: AssemblyVersion("1.0.*")]
#endif
```
16 changes: 9 additions & 7 deletions eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23468.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.24121.1</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.187-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
<_BasicReferenceAssembliesVersion>1.7.2</_BasicReferenceAssembliesVersion>
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
<CodeStyleAnalyzerVersion>4.8.0-3.final</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>17.10.72-preview</VisualStudioEditorPackagesVersion>
Expand Down Expand Up @@ -293,13 +294,14 @@
<PackageVersion Include="runtime.linux-x64.Microsoft.NETCore.ILAsm" Version="$(ILAsmPackageVersion)" />
<PackageVersion Include="runtime.osx-x64.Microsoft.NETCore.ILAsm" Version="$(ILAsmPackageVersion)" />
<PackageVersion Include="Basic.CompilerLog.Util" Version="0.6.1" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net50" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net60" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net70" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.4.5" />
<PackageVersion Include="Basic.Reference.Assemblies.Net461" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard13" Version="1.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net50" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net60" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net70" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net461" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard13" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="$(_BasicReferenceAssembliesVersion)" />
<PackageVersion Include="Microsoft.TeamFoundationServer.Client" Version="19.232.0-preview" />
<!--
Microsoft.TeamFoundationServer.Client is referencing System.Data.SqlClient causing CG alert
Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24204.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24225.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>188340e12c0a372b1681ad6a5e72c608021efdba</Sha>
<Sha>67d23f4ba1813b315e7e33c71d18b63475f5c5f8</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="8.0.0-beta.24204.3">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="8.0.0-beta.24225.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>188340e12c0a372b1681ad6a5e72c608021efdba</Sha>
<Sha>67d23f4ba1813b315e7e33c71d18b63475f5c5f8</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.23475.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
Expand All @@ -144,9 +144,9 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>5d10d428050c0d6afef30a072c4ae68776621877</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.24204.3">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.24225.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>188340e12c0a372b1681ad6a5e72c608021efdba</Sha>
<Sha>67d23f4ba1813b315e7e33c71d18b63475f5c5f8</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23468.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
"Shipping",
"NonShipping"
],
"vsBranch": "main",
"vsBranch": "rel/d17.11",
"vsMajorVersion": 17,
"insertionCreateDraftPR": false,
"insertionTitlePrefix": "[d17.11 P1]"
Expand All @@ -224,7 +224,7 @@
],
"vsBranch": "main",
"vsMajorVersion": 17,
"insertionCreateDraftPR": true,
"insertionCreateDraftPR": false,
"insertionTitlePrefix": "[d17.11 P2]"
},
"dev/andrha/telemetry": {
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"xcopy-msbuild": "17.8.1-2"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24204.3",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24204.3",
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24225.1",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24225.1",
"Microsoft.Build.Traversal": "3.4.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ private static bool IsTopmostExpression(ExpressionSyntax node)
{
return node.WalkUpParentheses().Parent switch
{
LambdaExpressionSyntax _ => true,
AssignmentExpressionSyntax _ => true,
ConditionalExpressionSyntax _ => true,
ExpressionSyntax _ => false,
LambdaExpressionSyntax => true,
AssignmentExpressionSyntax => true,
ConditionalExpressionSyntax => true,
ExpressionSyntax => false,
_ => true
};
}
Expand All @@ -142,10 +142,10 @@ private static bool IsTrivial(AnalyzedPattern pattern)
{
return pattern switch
{
Not { Pattern: Constant _ } => true,
Not { Pattern: Source { PatternSyntax: ConstantPatternSyntax _ } } => true,
Not _ => false,
Binary _ => false,
Not { Pattern: Constant } => true,
Not { Pattern: Source { PatternSyntax: ConstantPatternSyntax } } => true,
Not => false,
Binary => false,
_ => true
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ internal class CSharpMakeMethodAsynchronousCodeFixProvider : AbstractMakeMethodA
private const string CS4034 = nameof(CS4034); // The 'await' operator can only be used within an async lambda expression. Consider marking this method with the 'async' modifier.
private const string CS0246 = nameof(CS0246); // The type or namespace name 'await' could not be found

private static readonly SyntaxToken s_asyncKeywordWithSpace = AsyncKeyword.WithoutTrivia().WithTrailingTrivia(Space);

[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
public CSharpMakeMethodAsynchronousCodeFixProvider()
Expand Down Expand Up @@ -92,7 +94,7 @@ private static MethodDeclarationSyntax FixMethod(
CancellationToken cancellationToken)
{
var newReturnType = FixMethodReturnType(keepVoid, methodSymbol, method.ReturnType, knownTypes, cancellationToken);
var newModifiers = AddAsyncModifierWithCorrectedTrivia(method.Modifiers, ref newReturnType);
(var newModifiers, newReturnType) = AddAsyncModifierWithCorrectedTrivia(method.Modifiers, newReturnType);
return method.WithReturnType(newReturnType).WithModifiers(newModifiers);
}

Expand All @@ -104,7 +106,7 @@ private static LocalFunctionStatementSyntax FixLocalFunction(
CancellationToken cancellationToken)
{
var newReturnType = FixMethodReturnType(keepVoid, methodSymbol, localFunction.ReturnType, knownTypes, cancellationToken);
var newModifiers = AddAsyncModifierWithCorrectedTrivia(localFunction.Modifiers, ref newReturnType);
(var newModifiers, newReturnType) = AddAsyncModifierWithCorrectedTrivia(localFunction.Modifiers, newReturnType);
return localFunction.WithReturnType(newReturnType).WithModifiers(newModifiers);
}

Expand Down Expand Up @@ -176,15 +178,15 @@ private static bool IsIEnumerable(ITypeSymbol returnType, KnownTaskTypes knownTy
private static bool IsIEnumerator(ITypeSymbol returnType, KnownTaskTypes knownTypes)
=> returnType.OriginalDefinition.Equals(knownTypes.IEnumeratorOfTType);

private static SyntaxTokenList AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, ref TypeSyntax newReturnType)
private static (SyntaxTokenList newModifiers, TypeSyntax newReturnType) AddAsyncModifierWithCorrectedTrivia(SyntaxTokenList modifiers, TypeSyntax returnType)
{
if (modifiers.Any())
return modifiers.Add(AsyncKeyword);
return (modifiers.Add(s_asyncKeywordWithSpace), returnType);

// Move the leading trivia from the return type to the new modifiers list.
var result = TokenList(AsyncKeyword.WithLeadingTrivia(newReturnType.GetLeadingTrivia()));
newReturnType = newReturnType.WithoutLeadingTrivia();
return result;
var newModifiers = TokenList(s_asyncKeywordWithSpace.WithLeadingTrivia(returnType.GetLeadingTrivia()));
var newReturnType = returnType.WithoutLeadingTrivia();
return (newModifiers, newReturnType);
}

private static AnonymousFunctionExpressionSyntax FixAnonymousFunction(AnonymousFunctionExpressionSyntax anonymous)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down Expand Up @@ -86,7 +85,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down Expand Up @@ -126,7 +124,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down Expand Up @@ -166,7 +163,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down Expand Up @@ -206,7 +202,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down Expand Up @@ -246,7 +241,6 @@ class C
void Goo()
{
a?.Invoke();
a?.Invoke();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ class C
{
public void M1()
{
Func<int, Task> foo = x => {
Func<int, Task> foo = x =>
{
if (System.DateTime.Now.Ticks > 0)
{
return Task.CompletedTask;
Expand Down Expand Up @@ -1040,7 +1041,8 @@ class C
{
public void M1()
{
Func<Task> foo = () => {
Func<Task> foo = () =>
{
if (System.DateTime.Now.Ticks > 0)
{
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ class Program
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestRedundantRestoreDiffersFromPriorContext(NullableContextOptions compilationContext)
{
var enable = compilationContext != NullableContextOptions.Enable;
Expand All @@ -146,8 +145,7 @@ class Program
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestRedundantRestoreMatchesCompilation(NullableContextOptions compilationContext)
{
await VerifyCodeFixAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2180,8 +2180,7 @@ class MyClass
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task MultipleFields_AllUnused_FixOne(
[CombinatorialValues("[|_goo|]", "[|_goo|] = 0")] string firstField,
[CombinatorialValues("[|_bar|]", "[|_bar|] = 2")] string secondField,
Expand Down
Loading

0 comments on commit c1fd7b3

Please sign in to comment.