From 93fb6273beec3fdd103de132dc50b0450cc8807c Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Sat, 2 Nov 2024 19:38:15 +0000
Subject: [PATCH 1/2] Fix compilation with latest roslyn
---
.../test/Circuits/ServerComponentDeserializerTest.cs | 2 +-
.../BasicTestApp/EventDuringBatchRendering.razor | 2 +-
.../DataProtection/src/Internal/ContainerUtils.cs | 2 +-
.../App.Runtime/src/CompatibilitySuppressions.xml | 2 +-
.../Infrastructure/SyntaxNodeExtensions.cs | 3 ++-
.../RouteHandlers/DetectMisplacedLambdaAttribute.cs | 2 +-
.../src/Shared/Server/MethodOptions.cs | 2 +-
.../Hosting/src/GenericHost/GenericWebHostService.cs | 2 +-
src/Hosting/Hosting/src/Internal/StartupLoader.cs | 2 +-
src/Hosting/Hosting/src/Internal/WebHost.cs | 2 +-
.../Routing/test/UnitTests/Tree/TreeRouterTest.cs | 11 ++++++-----
.../WebUtilities/test/FileBufferingReadStreamTests.cs | 2 +-
.../DeveloperExceptionPageMiddlewareImpl.cs | 6 +++---
.../src/Extensions/JsonNodeSchemaExtensions.cs | 2 +-
.../Connections.Abstractions/src/ConnectionBuilder.cs | 2 +-
.../src/MultiplexedConnectionBuilder.cs | 2 +-
.../Kestrel/Core/src/Internal/KestrelServerImpl.cs | 4 ++--
src/Testing/src/xunit/DockerOnlyAttribute.cs | 2 +-
18 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/Components/Server/test/Circuits/ServerComponentDeserializerTest.cs b/src/Components/Server/test/Circuits/ServerComponentDeserializerTest.cs
index d9adcd29ba33..b07bdb5e6b1c 100644
--- a/src/Components/Server/test/Circuits/ServerComponentDeserializerTest.cs
+++ b/src/Components/Server/test/Circuits/ServerComponentDeserializerTest.cs
@@ -156,7 +156,7 @@ public void CanParseMultipleMarkersWithAndWithoutParameters()
public void DoesNotParseOutOfOrderMarkers()
{
// Arrange
- var markers = SerializeMarkers(CreateMarkers(typeof(TestComponent), typeof(TestComponent)).Reverse().ToArray());
+ var markers = SerializeMarkers(Enumerable.Reverse(CreateMarkers(typeof(TestComponent), typeof(TestComponent))).ToArray());
var serverComponentDeserializer = CreateServerComponentDeserializer();
// Act & assert
diff --git a/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor b/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
index 91cab3f7c744..cb2c610d950b 100644
--- a/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
+++ b/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
@@ -45,7 +45,7 @@
@foreach (var item in itemsList)
{
- itemsList.Reverse())"
+ Enumerable.Reverse(itemsList))"
@onchange="@(evt => eventLog += $"Change event on item {item.Name} with value {evt.Value}\n")" />
}
diff --git a/src/DataProtection/DataProtection/src/Internal/ContainerUtils.cs b/src/DataProtection/DataProtection/src/Internal/ContainerUtils.cs
index 5ae6c60ca89b..3e49202877a8 100644
--- a/src/DataProtection/DataProtection/src/Internal/ContainerUtils.cs
+++ b/src/DataProtection/DataProtection/src/Internal/ContainerUtils.cs
@@ -103,7 +103,7 @@ private static bool IsProcessRunningInContainer()
var lines = File.ReadAllLines(procFile);
// typically the last line in the file is "1:name=openrc:/docker"
- return lines.Reverse().Any(l => l.EndsWith("name=openrc:/docker", StringComparison.Ordinal));
+ return Enumerable.Reverse(lines).Any(l => l.EndsWith("name=openrc:/docker", StringComparison.Ordinal));
}
private static bool GetBooleanEnvVar(string envVarName)
diff --git a/src/Framework/App.Runtime/src/CompatibilitySuppressions.xml b/src/Framework/App.Runtime/src/CompatibilitySuppressions.xml
index 117ec7137b65..2b57d860ed2b 100644
--- a/src/Framework/App.Runtime/src/CompatibilitySuppressions.xml
+++ b/src/Framework/App.Runtime/src/CompatibilitySuppressions.xml
@@ -1,5 +1,5 @@
-
+
PKV0001
diff --git a/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/SyntaxNodeExtensions.cs b/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/SyntaxNodeExtensions.cs
index 3eba331a5ffb..ca244de30c0b 100644
--- a/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/SyntaxNodeExtensions.cs
+++ b/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/SyntaxNodeExtensions.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
+using System.Linq;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
@@ -126,7 +127,7 @@ private static SyntaxToken GetInitialToken(
///
private static SyntaxToken FindSkippedTokenBackward(SyntaxTriviaList triviaList, int position)
{
- foreach (var trivia in triviaList.Reverse())
+ foreach (var trivia in Enumerable.Reverse(triviaList))
{
if (trivia.HasStructure)
{
diff --git a/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs b/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs
index c6025fe0431f..ef6f1131d769 100644
--- a/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs
+++ b/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs
@@ -70,7 +70,7 @@ static bool IsInValidNamespace(INamespaceSymbol? @namespace)
static IMethodSymbol? GetReturnedInvocation(IBlockOperation blockOperation)
{
- foreach (var op in blockOperation.ChildOperations.Reverse())
+ foreach (var op in Enumerable.Reverse(blockOperation.ChildOperations))
{
if (op is IReturnOperation returnStatement)
{
diff --git a/src/Grpc/JsonTranscoding/src/Shared/Server/MethodOptions.cs b/src/Grpc/JsonTranscoding/src/Shared/Server/MethodOptions.cs
index 1ed83b6ea24b..1fdf601659e7 100644
--- a/src/Grpc/JsonTranscoding/src/Shared/Server/MethodOptions.cs
+++ b/src/Grpc/JsonTranscoding/src/Shared/Server/MethodOptions.cs
@@ -116,7 +116,7 @@ public static MethodOptions Create(IEnumerable serviceOption
string? responseCompressionAlgorithm = null;
CompressionLevel? responseCompressionLevel = null;
- foreach (var options in serviceOptions.Reverse())
+ foreach (var options in Enumerable.Reverse(serviceOptions))
{
AddCompressionProviders(resolvedCompressionProviders, options.CompressionProviders);
tempInterceptors.InsertRange(0, options.Interceptors);
diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostService.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostService.cs
index 9ac3001c9b0f..c5dc58cd8251 100644
--- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostService.cs
+++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostService.cs
@@ -132,7 +132,7 @@ static string ExpandPorts(string ports, string scheme)
var builder = ApplicationBuilderFactory.CreateBuilder(Server.Features);
- foreach (var filter in StartupFilters.Reverse())
+ foreach (var filter in Enumerable.Reverse(StartupFilters))
{
configure = filter.Configure(configure);
}
diff --git a/src/Hosting/Hosting/src/Internal/StartupLoader.cs b/src/Hosting/Hosting/src/Internal/StartupLoader.cs
index 6124347cebc3..3989a7786bcc 100644
--- a/src/Hosting/Hosting/src/Internal/StartupLoader.cs
+++ b/src/Hosting/Hosting/src/Internal/StartupLoader.cs
@@ -222,7 +222,7 @@ void RunPipeline(TContainerBuilder containerBuilder)
#pragma warning restore CS0612 // Type or member is obsolete
Action pipeline = InvokeConfigureContainer;
- foreach (var filter in filters.Reverse())
+ foreach (var filter in Enumerable.Reverse(filters))
{
pipeline = filter.ConfigureContainer(pipeline);
}
diff --git a/src/Hosting/Hosting/src/Internal/WebHost.cs b/src/Hosting/Hosting/src/Internal/WebHost.cs
index 404ba7107c90..6626cdda9889 100644
--- a/src/Hosting/Hosting/src/Internal/WebHost.cs
+++ b/src/Hosting/Hosting/src/Internal/WebHost.cs
@@ -214,7 +214,7 @@ private RequestDelegate BuildApplication()
Action configure = _startup!.Configure;
if (startupFilters != null)
{
- foreach (var filter in startupFilters.Reverse())
+ foreach (var filter in Enumerable.Reverse(startupFilters))
{
configure = filter.Configure(configure);
}
diff --git a/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs b/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs
index 951ebc1fd4c5..ad97a08408b0 100644
--- a/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs
+++ b/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Globalization;
+using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.AspNetCore.Routing.Template;
@@ -100,7 +101,7 @@ public async Task TreeRouter_RouteAsync_MatchesRouteWithTheRightLength(string ur
// We setup the route entries in reverse order of precedence to ensure that when we
// try to route the request, the route with a higher precedence gets tried first.
- foreach (var template in routes.Reverse())
+ foreach (var template in Enumerable.Reverse(routes))
{
MapInboundEntry(builder, template);
}
@@ -147,7 +148,7 @@ public async Task TreeRouter_RouteAsync_MatchesRoutesWithDefaults(string url, ob
// We setup the route entries in reverse order of precedence to ensure that when we
// try to route the request, the route with a higher precedence gets tried first.
- foreach (var template in routes.Reverse())
+ foreach (var template in Enumerable.Reverse(routes))
{
MapInboundEntry(builder, template);
}
@@ -199,7 +200,7 @@ public async Task TreeRouter_RouteAsync_MatchesConstrainedRoutesWithDefaults(str
// We setup the route entries in reverse order of precedence to ensure that when we
// try to route the request, the route with a higher precedence gets tried first.
- foreach (var template in routes.Reverse())
+ foreach (var template in Enumerable.Reverse(routes))
{
MapInboundEntry(builder, template);
}
@@ -242,7 +243,7 @@ public async Task TreeRouter_RouteAsync_MatchesCatchAllRoutesWithDefaults()
// We setup the route entries in reverse order of precedence to ensure that when we
// try to route the request, the route with a higher precedence gets tried first.
- foreach (var template in routes.Reverse())
+ foreach (var template in Enumerable.Reverse(routes))
{
MapInboundEntry(builder, template);
}
@@ -340,7 +341,7 @@ public async Task TreeRouter_RouteAsync_DoesNotMatchShorterUrl()
// We setup the route entries in reverse order of precedence to ensure that when we
// try to route the request, the route with a higher precedence gets tried first.
- foreach (var template in routes.Reverse())
+ foreach (var template in Enumerable.Reverse(routes))
{
MapInboundEntry(builder, template);
}
diff --git a/src/Http/WebUtilities/test/FileBufferingReadStreamTests.cs b/src/Http/WebUtilities/test/FileBufferingReadStreamTests.cs
index c38dcbd2df91..51ec5de92648 100644
--- a/src/Http/WebUtilities/test/FileBufferingReadStreamTests.cs
+++ b/src/Http/WebUtilities/test/FileBufferingReadStreamTests.cs
@@ -488,7 +488,7 @@ public async Task CopyToAsyncWorksWithFileThreshold()
// 4K is the lower bound on buffer sizes
var bufferSize = 4096;
var mostExpectedWrites = 8;
- var data = Enumerable.Range(0, bufferSize * mostExpectedWrites).Select(b => (byte)b).Reverse().ToArray();
+ var data = Enumerable.Reverse(Enumerable.Range(0, bufferSize * mostExpectedWrites).Select(b => (byte)b)).ToArray();
var inner = new MemoryStream(data);
using var stream = new FileBufferingReadStream(inner, 100, bufferLimit: null, GetCurrentDirectory());
diff --git a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddlewareImpl.cs b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddlewareImpl.cs
index 2f33111ccb3b..5d2589052eed 100644
--- a/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddlewareImpl.cs
+++ b/src/Middleware/Diagnostics/src/DeveloperExceptionPage/DeveloperExceptionPageMiddlewareImpl.cs
@@ -67,7 +67,7 @@ public DeveloperExceptionPageMiddlewareImpl(
_exceptionHandler = DisplayException;
_serializationContext = CreateSerializationContext(jsonOptions?.Value);
_problemDetailsService = problemDetailsService;
- foreach (var filter in filters.Reverse())
+ foreach (var filter in Enumerable.Reverse(filters))
{
var nextFilter = _exceptionHandler;
_exceptionHandler = errorContext => filter.HandleExceptionAsync(errorContext, nextFilter);
@@ -228,8 +228,8 @@ private async Task DisplayExceptionContent(ErrorContext errorContext)
if (_problemDetailsService == null || !await _problemDetailsService.TryWriteAsync(new()
{
HttpContext = httpContext,
- ProblemDetails = CreateProblemDetails(errorContext, httpContext),
- Exception = errorContext.Exception
+ ProblemDetails = CreateProblemDetails(errorContext, httpContext),
+ Exception = errorContext.Exception
}))
{
httpContext.Response.ContentType = "text/plain; charset=utf-8";
diff --git a/src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs b/src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs
index 9cc97724b1b3..ede909c6e579 100644
--- a/src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs
+++ b/src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs
@@ -196,7 +196,7 @@ internal static void ApplyRouteConstraints(this JsonNode schema, IEnumerable l.EndsWith("name=openrc:/docker", StringComparison.Ordinal));
+ return Enumerable.Reverse(lines).Any(l => l.EndsWith("name=openrc:/docker", StringComparison.Ordinal));
}
}
}
From b103589ed0547b9d8972343a426b41d4504000c9 Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Sat, 2 Nov 2024 23:43:23 +0200
Subject: [PATCH 2/2] .
---
.../testassets/BasicTestApp/EventDuringBatchRendering.razor | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor b/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
index cb2c610d950b..91cab3f7c744 100644
--- a/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
+++ b/src/Components/test/testassets/BasicTestApp/EventDuringBatchRendering.razor
@@ -45,7 +45,7 @@
@foreach (var item in itemsList)
{
- Enumerable.Reverse(itemsList))"
+ itemsList.Reverse())"
@onchange="@(evt => eventLog += $"Change event on item {item.Name} with value {evt.Value}\n")" />
}