Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
77f2de5
[VMR] Codeflow d3571ef-d3571ef
dotnet-maestro[bot] Jul 13, 2025
9c4f3cb
Update dependencies from https://github.com/dotnet/dotnet build 275021
dotnet-maestro[bot] Jul 13, 2025
b5f086c
Update dependencies from https://github.com/dotnet/dotnet build 275039
dotnet-maestro[bot] Jul 14, 2025
c883fa8
Update dependencies from https://github.com/dotnet/dotnet build 275143
dotnet-maestro[bot] Jul 15, 2025
2090589
Update dependencies from https://github.com/dotnet/dotnet build 275313
dotnet-maestro[bot] Jul 16, 2025
e902f73
[VMR] Codeflow c1794aa-c1794aa
dotnet-maestro[bot] Jul 17, 2025
bd43270
Merge main into darc-main-57e3e1c1-dd38-4d3c-972a-3179887d0977
dotnet-maestro[bot] Jul 17, 2025
d2cf001
Update dependencies from https://github.com/dotnet/dotnet build 275513
dotnet-maestro[bot] Jul 17, 2025
173e151
Merge main into darc-main-57e3e1c1-dd38-4d3c-972a-3179887d0977
dotnet-maestro[bot] Jul 17, 2025
c8814bb
Update dependencies from https://github.com/dotnet/dotnet build 275594
dotnet-maestro[bot] Jul 17, 2025
74584f5
[VMR] Codeflow 462275d-462275d
dotnet-maestro[bot] Jul 17, 2025
a76075d
Update dependencies from https://github.com/dotnet/dotnet build 275638
dotnet-maestro[bot] Jul 17, 2025
27b770e
Update dependencies from https://github.com/dotnet/dotnet build 275766
dotnet-maestro[bot] Jul 18, 2025
6dc9350
[VMR] Codeflow 37a47b7-37a47b7
dotnet-maestro[bot] Jul 19, 2025
4edcf04
Update dependencies from https://github.com/dotnet/dotnet build 275814
dotnet-maestro[bot] Jul 19, 2025
f52a825
Update dependencies from https://github.com/dotnet/dotnet build 275898
dotnet-maestro[bot] Jul 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Particularly for developers who aren't experienced with .NET Core development on
1. Install [VS Code](https://code.visualstudio.com/Download)
- After you install VS Code, install the [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
- Important tip: You can look up editor commands by name by hitting *Ctrl+Shift+P*, or by hitting *Ctrl+P* and typing a `>` character. This will help you get familiar with editor commands mentioned below. On a Mac, use *⌘* instead of *Ctrl*.
1. Install the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
1. Install the [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The minimal required version of .NET Framework is 4.7.2.
- Ensure C# and Visual Basic, MSBuild, and .NET Core are included in the selected individual components
- Ensure "Use previews of the .NET Core SDK" is checked in Tools -> Options -> Environment -> Preview Features
- Restart Visual Studio
1. Install the [.NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
1. Install the [.NET 10.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) which matches the `sdk.version` property in [global.json](../../global.json#L3)
1. [PowerShell 5.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on earlier versions of Windows. The download link is under the ["Upgrading existing Windows PowerShell"](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell) heading.
1. Run Restore.cmd
1. Open Roslyn.sln
Expand Down
2 changes: 1 addition & 1 deletion eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
<PackageVersion Include="xunit.core" Version="$(_xunitVersion)" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.extensibility.core" Version="$(_xunitVersion)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3" />
<PackageVersion Include="xunit.runner.utility" Version="$(_xunitVersion)" />
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
<PackageVersion Include="xunit.extensibility.execution" Version="$(_xunitVersion)" />
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="roslyn" Sha="f451e5d3036a4f140a989e0a7f3f1ae432420e71" BarId="274568" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="roslyn" Sha="1c92f346e02a8363def6f7bdbcc526d3c579dd74" BarId="275898" />
<ProductDependencies>
<!-- RoslynAnalyzers reference older builds of Roslyn and this is necessary for SourceBuild. -->
<Dependency Name="Microsoft.CodeAnalysis" Version="3.11.0">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>ae1fff344d46976624e68ae17164e0607ab68b10</Sha>
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta5.25210.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>e9b0511d7f1128e2bc3be7a658a2a4ea977e602d</Sha>
<Dependency Name="System.CommandLine" Version="2.0.0-beta7.25368.105">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>1c92f346e02a8363def6f7bdbcc526d3c579dd74</Sha>
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0">
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
Versions managed by Arcade (see Versions.Details.xml)
-->
<PropertyGroup>
<SystemCommandLineVersion>2.0.0-beta5.25210.1</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta7.25368.105</SystemCommandLineVersion>
<SystemCompositionVersion>9.0.0</SystemCompositionVersion>
<SystemConfigurationConfigurationManagerVersion>9.0.0</SystemConfigurationConfigurationManagerVersion>
<SystemDiagnosticsEventLogVersion>9.0.0</SystemDiagnosticsEventLogVersion>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"sdk": {
"version": "10.0.100-preview.5.25277.114",
"version": "10.0.100-preview.6.25358.103",
"allowPrerelease": false,
"rollForward": "patch"
},
"tools": {
"dotnet": "10.0.100-preview.5.25277.114",
"dotnet": "10.0.100-preview.6.25358.103",
"vs": {
"version": "17.14.0"
},
Expand Down
31 changes: 0 additions & 31 deletions src/Compilers/Core/Portable/InternalUtilities/EmptyComparer.cs

This file was deleted.

63 changes: 63 additions & 0 deletions src/Dependencies/Contracts/EqualityComparerExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

#if !NET8_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace System.Collections.Generic;

internal static class RoslynEqualityComparerExtensions
{
#if NET8_0_OR_GREATER

// for binary compatibility
public static EqualityComparer<T> Create<T>(Func<T?, T?, bool> equals, Func<T, int>? getHashCode = null)
=> EqualityComparer<T>.Create(equals, getHashCode);

#else
// Implementation based on https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.cs

extension<T>(EqualityComparer<T>)
{
/// <summary>
/// Creates an <see cref="EqualityComparer{T}"/> by using the specified delegates as the implementation of the comparer's
/// <see cref="EqualityComparer{T}.Equals"/> and <see cref="EqualityComparer{T}.GetHashCode"/> methods.
/// </summary>
/// <param name="equals">The delegate to use to implement the <see cref="EqualityComparer{T}.Equals"/> method.</param>
/// <param name="getHashCode">
/// The delegate to use to implement the <see cref="EqualityComparer{T}.GetHashCode"/> method.
/// If no delegate is supplied, calls to the resulting comparer's <see cref="EqualityComparer{T}.GetHashCode"/>
/// will throw <see cref="NotSupportedException"/>.
/// </param>
/// <returns>The new comparer.</returns>
public static EqualityComparer<T> Create(Func<T?, T?, bool> equals, Func<T, int>? getHashCode = null)
{
getHashCode ??= _ => throw new NotSupportedException();
return new DelegateEqualityComparer<T>(equals, getHashCode);
}
}

private sealed class DelegateEqualityComparer<T>(Func<T?, T?, bool> equals, Func<T, int> getHashCode) : EqualityComparer<T>
{
private readonly Func<T?, T?, bool> _equals = equals;
private readonly Func<T, int> _getHashCode = getHashCode;

public override bool Equals(T? x, T? y) =>
_equals(x, y);

public override int GetHashCode(T obj) =>
_getHashCode(obj);

public override bool Equals(object? obj)
=> obj is DelegateEqualityComparer<T> other && _equals == other._equals && _getHashCode == other._getHashCode;

public override int GetHashCode()
=> unchecked(_equals.GetHashCode() * (int)0xA5555529 + _getHashCode.GetHashCode());
}
#endif
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<Compile Include="$(MSBuildThisFileDirectory)RequiredMemberAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SetsRequiredMembersAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ExceptionUtilities.cs" />
<Compile Include="$(MSBuildThisFileDirectory)EqualityComparerExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ReferenceEqualityComparer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Index.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Range.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ErrorReporting\FatalError.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

using System.Runtime.CompilerServices;

#if NET5_0_OR_GREATER
#nullable enable

#if NET

#pragma warning disable RS0016 // Add public types and members to the declared API (this is a supporting forwarder for an internal polyfill API)
[assembly: TypeForwardedTo(typeof(System.Collections.Generic.ReferenceEqualityComparer))]
Expand Down Expand Up @@ -45,7 +47,7 @@
/// <param name="obj">The object for which to retrieve the hash code.</param>
/// <returns>A hash code for the identity of <paramref name="obj"/>.</returns>
/// <remarks>
/// This API is a wrapper around <see cref="RuntimeHelpers.GetHashCode(object)"/>.

Check failure on line 50 in src/Dependencies/Contracts/ReferenceEqualityComparer.cs

View check run for this annotation

Azure Pipelines / roslyn-CI (Correctness Correctness_Analyzers)

src/Dependencies/Contracts/ReferenceEqualityComparer.cs#L50

src/Dependencies/Contracts/ReferenceEqualityComparer.cs(50,49): error CS1574: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has cref attribute 'GetHashCode(object)' that could not be resolved

Check failure on line 50 in src/Dependencies/Contracts/ReferenceEqualityComparer.cs

View check run for this annotation

Azure Pipelines / roslyn-CI

src/Dependencies/Contracts/ReferenceEqualityComparer.cs#L50

src/Dependencies/Contracts/ReferenceEqualityComparer.cs(50,49): error CS1574: (NETCORE_ENGINEERING_TELEMETRY=Build) XML comment has cref attribute 'GetHashCode(object)' that could not be resolved
/// It is not necessarily equivalent to calling <see cref="object.GetHashCode()"/>.
/// </remarks>
public int GetHashCode(object? obj)
Expand Down
24 changes: 19 additions & 5 deletions src/EditorFeatures/Core/Remote/SolutionChecksumUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ErrorReporting;
Expand Down Expand Up @@ -102,11 +103,24 @@ private void OnWorkspaceChanged(WorkspaceChangeEventArgs _)

private void OnWorkspaceChangedImmediate(WorkspaceChangeEventArgs e)
{
if (e.Kind == WorkspaceChangeKind.DocumentChanged)
if (e.Kind is WorkspaceChangeKind.DocumentChanged or WorkspaceChangeKind.AdditionalDocumentChanged)
{
var documentId = e.DocumentId!;
var oldDocument = e.OldSolution.GetRequiredDocument(documentId);
var newDocument = e.NewSolution.GetRequiredDocument(documentId);
TextDocument oldDocument;
TextDocument newDocument;

if (e.Kind == WorkspaceChangeKind.DocumentChanged)
{
oldDocument = e.OldSolution.GetRequiredDocument(documentId);
newDocument = e.NewSolution.GetRequiredDocument(documentId);
}
else
{
Debug.Assert(e.Kind == WorkspaceChangeKind.AdditionalDocumentChanged);

oldDocument = e.OldSolution.GetRequiredAdditionalDocument(documentId);
newDocument = e.NewSolution.GetRequiredAdditionalDocument(documentId);
}

// Fire-and-forget to dispatch notification of this document change event to the remote side
// and return to the caller as quickly as possible.
Expand Down Expand Up @@ -157,8 +171,8 @@ await client.TryInvokeAsync<IRemoteAssetSynchronizationService>(
}

private async Task DispatchSynchronizeTextChangesAsync(
Document oldDocument,
Document newDocument)
TextDocument oldDocument,
TextDocument newDocument)
{
// Explicitly force a yield point here to ensure this method returns to the caller immediately and that
// all work is done off the calling thread.
Expand Down
13 changes: 3 additions & 10 deletions src/EditorFeatures/Test/Collections/Immutable/Maps/MapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public void TestRemove()
[Fact]
public void TestPathology()
{
var map = ImmutableDictionary.Create<string, int>(new PathologicalComparer<string>())
var comparer = EqualityComparer<string>.Create(EqualityComparer<string>.Default.Equals, _ => 0);

var map = ImmutableDictionary.Create<string, int>(comparer)
.Add("1", 1)
.Add("2", 2)
.Add("3", 3)
Expand Down Expand Up @@ -118,13 +120,4 @@ public void TestPathology()
map = map.Remove("5");
Assert.Empty(map);
}

private sealed class PathologicalComparer<T> : IEqualityComparer<T>
{
public bool Equals(T x, T y)
=> EqualityComparer<T>.Default.Equals(x, y);

public int GetHashCode(T obj)
=> 0;
}
}
54 changes: 54 additions & 0 deletions src/EditorFeatures/Test2/Rename/InlineRenameTests.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2473,5 +2473,59 @@ class [|C|]
</Workspace>, host:=host, renameTo:="MyNewProperty")
End Using
End Sub

<WpfTheory>
<CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub RenameClassWithAttributeName(host As RenameTestHost)
Using result = RenameEngineResult.Create(_outputHelper,
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
public class [|$$MyClassAttribute|] : System.Attribute
{
public [|MyClassAttribute|]()
{

}
}
']]>
</Document>
</Project>
</Workspace>, host:=host, renameTo:="MyClassAttribute2")
End Using
End Sub

<WpfTheory>
<CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)>
Public Async Function RenameClassWithAttributeName2(host As RenameTestHost) As Task
Using workspace = CreateWorkspaceWithWaiter(
<Workspace>
<Project Language="C#" CommonReferences="true" LanguageVersion="preview">
<Document>
public class [|MyClass$$Attribute|] : System.Attribute
{
public [|MyClassAttribute|]()
{

}
}
</Document>
</Project>
</Workspace>, host)

Dim session = StartSession(workspace)

' Type a bit in the file
Dim caretPosition = workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value
Dim textBuffer = workspace.Documents.Single().GetTextBuffer()

textBuffer.Insert(caretPosition, "2")

Await session.CommitAsync(previewChanges:=False, editorOperationContext:=Nothing)

Await VerifyTagsAreCorrect(workspace)
End Using
End Function
End Class
End Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ namespace Microsoft.CodeAnalysis.Completion.Providers;
internal abstract partial class AbstractKeywordCompletionProvider<TContext> : LSPCompletionProvider
where TContext : SyntaxContext
{
private static readonly Comparer s_comparer = new();
private static readonly EqualityComparer<CompletionItem> s_comparer = EqualityComparer<CompletionItem>.Create(
static (x, y) => x?.DisplayText == y?.DisplayText,
static x => x.DisplayText.GetHashCode());

private readonly ImmutableArray<IKeywordRecommender<TContext>> _keywordRecommenders;

Expand Down Expand Up @@ -72,13 +74,4 @@ private async Task<ImmutableArray<RecommendedKeyword>> RecommendKeywordsAsync(

public sealed override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem item, char? ch, CancellationToken cancellationToken)
=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));

private sealed class Comparer : IEqualityComparer<CompletionItem>
{
public bool Equals(CompletionItem? x, CompletionItem? y)
=> x?.DisplayText == y?.DisplayText;

public int GetHashCode(CompletionItem obj)
=> Hash.Combine(obj.DisplayText.GetHashCode(), obj.DisplayText.GetHashCode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@

WindowsErrorReporting.SetErrorModeOnWindows();

var parser = CreateCommandLineParser();
return await parser.Parse(args).InvokeAsync(CancellationToken.None);
var command = CreateCommand();
var invocationConfiguration = new InvocationConfiguration()
{
// By default, System.CommandLine will catch all exceptions, log them to the console, and return a non-zero exit code.
// Unfortunately this makes .NET's crash dump collection environment variables (e.g. 'DOTNET_DbgEnableMiniDump')
// entirely useless as it never detects an actual crash. Disable this behavior so we can collect crash dumps when asked to.
EnableDefaultExceptionHandler = false
};
return await command.Parse(args).InvokeAsync(invocationConfiguration, CancellationToken.None);

static async Task RunAsync(ServerConfiguration serverConfiguration, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -167,7 +174,7 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation
}
}

static CommandLineConfiguration CreateCommandLineParser()
static RootCommand CreateCommand()
{
var debugOption = new Option<bool>("--debug")
{
Expand Down Expand Up @@ -294,15 +301,7 @@ static CommandLineConfiguration CreateCommandLineParser()
return RunAsync(serverConfiguration, cancellationToken);
});

var config = new CommandLineConfiguration(rootCommand)
{
// By default, System.CommandLine will catch all exceptions, log them to the console, and return a non-zero exit code.
// Unfortunately this makes .NET's crash dump collection environment variables (e.g. 'DOTNET_DbgEnableMiniDump')
// entirely useless as it never detects an actual crash. Disable this behavior so we can collect crash dumps when asked to.
EnableDefaultExceptionHandler = false
};

return config;
return rootCommand;
}

static (string clientPipe, string serverPipe) CreateNewPipeNames()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static Task<int> Main(string[] args)
return HandleAsync(commandLineArgs, cancellationToken);
});

return rootCommand.Parse(args).InvokeAsync(CancellationToken.None);
return rootCommand.Parse(args).InvokeAsync(null, CancellationToken.None);
}

private static async Task<int> HandleAsync(CommandLineArgs args, CancellationToken cancellationToken)
Expand Down
Loading
Loading