Skip to content

Commit ebd92a8

Browse files
[main] Source code updates from dotnet/dotnet (#79483)
[main] Source code updates from dotnet/dotnet - Workaround cref resolve issue due to new RuntimeHelpers in SCI
1 parent e67e2a4 commit ebd92a8

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
3-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="roslyn" Sha="f451e5d3036a4f140a989e0a7f3f1ae432420e71" BarId="274568" />
3+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="roslyn" Sha="96ac952a7886b565e83acc4c9cef656954ed0686" BarId="276277" />
44
<ProductDependencies>
55
<!-- RoslynAnalyzers reference older builds of Roslyn and this is necessary for SourceBuild. -->
66
<Dependency Name="Microsoft.CodeAnalysis" Version="3.11.0">
77
<Uri>https://github.com/dotnet/roslyn</Uri>
88
<Sha>ae1fff344d46976624e68ae17164e0607ab68b10</Sha>
99
</Dependency>
10-
<Dependency Name="System.CommandLine" Version="2.0.0-beta5.25210.1">
11-
<Uri>https://github.com/dotnet/command-line-api</Uri>
12-
<Sha>e9b0511d7f1128e2bc3be7a658a2a4ea977e602d</Sha>
10+
<Dependency Name="System.CommandLine" Version="2.0.0-beta7.25372.103">
11+
<Uri>https://github.com/dotnet/dotnet</Uri>
12+
<Sha>96ac952a7886b565e83acc4c9cef656954ed0686</Sha>
1313
</Dependency>
1414
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
1515
<Dependency Name="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0">

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Versions managed by Arcade (see Versions.Details.xml)
4949
-->
5050
<PropertyGroup>
51-
<SystemCommandLineVersion>2.0.0-beta5.25210.1</SystemCommandLineVersion>
51+
<SystemCommandLineVersion>2.0.0-beta7.25372.103</SystemCommandLineVersion>
5252
<SystemCompositionVersion>9.0.0</SystemCompositionVersion>
5353
<SystemConfigurationConfigurationManagerVersion>9.0.0</SystemConfigurationConfigurationManagerVersion>
5454
<SystemDiagnosticsEventLogVersion>9.0.0</SystemDiagnosticsEventLogVersion>

src/Dependencies/Contracts/ReferenceEqualityComparer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ private ReferenceEqualityComparer() { }
4040
/// </remarks>
4141
public new bool Equals(object? x, object? y) => ReferenceEquals(x, y);
4242

43+
#pragma warning disable CA1200 // Avoid using cref tags with a prefix - this works around cref not correctly resolving RuntimeHelpers as SCI also has an internal version without GetHashCode.
4344
/// <summary>
4445
/// Returns a hash code for the specified object. The returned hash code is based on the object
4546
/// identity, not on the contents of the object.
4647
/// </summary>
4748
/// <param name="obj">The object for which to retrieve the hash code.</param>
4849
/// <returns>A hash code for the identity of <paramref name="obj"/>.</returns>
4950
/// <remarks>
50-
/// This API is a wrapper around <see cref="RuntimeHelpers.GetHashCode(object)"/>.
51+
/// This API is a wrapper around <see cref="M:System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(object)"/>.
5152
/// It is not necessarily equivalent to calling <see cref="object.GetHashCode()"/>.
5253
/// </remarks>
54+
#pragma warning restore CA1200
5355
public int GetHashCode(object? obj)
5456
{
5557
// Depending on target framework, RuntimeHelpers.GetHashCode might not be annotated

src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@
3232

3333
WindowsErrorReporting.SetErrorModeOnWindows();
3434

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

3845
static async Task RunAsync(ServerConfiguration serverConfiguration, CancellationToken cancellationToken)
3946
{
@@ -167,7 +174,7 @@ static async Task RunAsync(ServerConfiguration serverConfiguration, Cancellation
167174
}
168175
}
169176

170-
static CommandLineConfiguration CreateCommandLineParser()
177+
static RootCommand CreateCommand()
171178
{
172179
var debugOption = new Option<bool>("--debug")
173180
{
@@ -294,15 +301,7 @@ static CommandLineConfiguration CreateCommandLineParser()
294301
return RunAsync(serverConfiguration, cancellationToken);
295302
});
296303

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

308307
static (string clientPipe, string serverPipe) CreateNewPipeNames()

src/RoslynAnalyzers/Tools/GenerateDocumentationAndConfigFiles/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static Task<int> Main(string[] args)
257257
return HandleAsync(commandLineArgs, cancellationToken);
258258
});
259259

260-
return rootCommand.Parse(args).InvokeAsync(CancellationToken.None);
260+
return rootCommand.Parse(args).InvokeAsync(null, CancellationToken.None);
261261
}
262262

263263
private static async Task<int> HandleAsync(CommandLineArgs args, CancellationToken cancellationToken)

0 commit comments

Comments
 (0)