diff --git a/Directory.Build.props b/Directory.Build.props
index 9eeb84ce52d..0b4fd822e07 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,10 +13,10 @@
$(TargetFrameworkName)$(TargetFrameworkVersion)
$(LatestTargetFramework)
- $(SupportedNetCoreTargetFrameworks);netcoreapp3.1
+ $(SupportedNetCoreTargetFrameworks);net6.0
- $(LatestTargetFramework)
+ net6.0
$(NetCoreTargetFrameworks)
- $(TestNetCoreTargetFrameworks);net7.0;net6.0
+ $(TestNetCoreTargetFrameworks);net6.0
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 3d858bb878f..7954433dfb6 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -16,6 +16,9 @@
false
+
+ $(NoWarn);TBD
+
$(NoWarn);IL2026;IL2087;IL2067;IL2075;IL2091;IL2072;IL2090;CA1825;IL2070;IL2098;IL2057
@@ -34,11 +37,6 @@
$(NoWarn);CA1062
-
-
- true
-
-
@@ -86,7 +84,7 @@
-
+
diff --git a/eng/MSBuild/Packaging.targets b/eng/MSBuild/Packaging.targets
index 348101beb74..be31f30d7d6 100644
--- a/eng/MSBuild/Packaging.targets
+++ b/eng/MSBuild/Packaging.targets
@@ -20,10 +20,6 @@
Condition="'$(MinimumSupportedTfmForPackaging)' != '' and
'$(ConditionalNet462)' != '' and
($(TargetFrameworks.Contains('$(MinimumSupportedTfmForPackaging)')) and $(TargetFrameworks.Contains('$(ConditionalNet462)')))" />
-
diff --git a/eng/packages/General.props b/eng/packages/General.props
index 2b191f99203..6049affefa0 100644
--- a/eng/packages/General.props
+++ b/eng/packages/General.props
@@ -74,8 +74,4 @@
-
-
-
-
diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props
index 5343aeeb35e..7613dcb64c4 100644
--- a/eng/packages/TestOnly.props
+++ b/eng/packages/TestOnly.props
@@ -20,11 +20,6 @@
-
-
-
-
-
diff --git a/global.json b/global.json
index 786c538ac00..e0e6cd27f9e 100644
--- a/global.json
+++ b/global.json
@@ -1,19 +1,15 @@
{
"sdk": {
- "version": "8.0.100-rc.1.23381.2"
+ "version": "8.0.100-rc.2.23462.28"
},
"tools": {
- "dotnet": "8.0.100-rc.1.23381.2",
+ "dotnet": "8.0.100-rc.2.23462.28",
"runtimes": {
"dotnet/x64": [
- "3.1.32",
- "6.0.16",
- "7.0.5"
+ "6.0.22"
],
"aspnetcore/x64": [
- "3.1.32",
- "6.0.16",
- "7.0.5"
+ "6.0.22"
]
}
},
diff --git a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/CallAnalyzer.Registrar.cs b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/CallAnalyzer.Registrar.cs
index 61b0b7bf1bb..b1efca26a84 100644
--- a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/CallAnalyzer.Registrar.cs
+++ b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/CallAnalyzer.Registrar.cs
@@ -34,7 +34,7 @@ public void RegisterMethod(IMethodSymbol method, Action restApiTypes, CancellationToken cancellationToken)
{
- Dictionary> metricClassesDict = new();
+ Dictionary> metricClassesDict = [];
foreach (var cl in restApiTypes)
{
if (!metricClassesDict.TryGetValue(cl.Namespace, out var list))
{
- list = new List();
+ list = [];
metricClassesDict.Add(cl.Namespace, list);
}
diff --git a/src/Generators/Microsoft.Gen.AutoClient/Parser.cs b/src/Generators/Microsoft.Gen.AutoClient/Parser.cs
index 338713fb6d1..81e9cb501d3 100644
--- a/src/Generators/Microsoft.Gen.AutoClient/Parser.cs
+++ b/src/Generators/Microsoft.Gen.AutoClient/Parser.cs
@@ -242,7 +242,7 @@ private static ParseInterfaceAttributesResult ParseInterfaceAttributes(Immutable
{
string? httpClientName = null;
string? customDependencyName = null;
- Dictionary staticHeaders = new();
+ Dictionary staticHeaders = [];
foreach (var classAttribute in classAttributes)
{
@@ -320,10 +320,10 @@ potentialNamespaceParent is not NamespaceDeclarationSyntax &&
private static ParseMethodAttributesResult ParseMethodAttributes(ImmutableArray methodAttributes, SymbolHolder symbols)
{
- List httpMethods = new();
+ List httpMethods = [];
string? requestName = null;
string? path = null;
- Dictionary staticHeaders = new();
+ Dictionary staticHeaders = [];
foreach (var methodAttribute in methodAttributes)
{
diff --git a/src/Generators/Microsoft.Gen.Metrics/Emitter.cs b/src/Generators/Microsoft.Gen.Metrics/Emitter.cs
index ded7ac7c35c..d6b0decec0d 100644
--- a/src/Generators/Microsoft.Gen.Metrics/Emitter.cs
+++ b/src/Generators/Microsoft.Gen.Metrics/Emitter.cs
@@ -20,12 +20,12 @@ internal sealed class Emitter : EmitterBase
public string EmitMetrics(IReadOnlyList metricTypes, CancellationToken cancellationToken)
{
- Dictionary> metricClassesDict = new();
+ Dictionary> metricClassesDict = [];
foreach (var cl in metricTypes)
{
if (!metricClassesDict.TryGetValue(cl.Namespace, out var list))
{
- list = new List();
+ list = [];
metricClassesDict.Add(cl.Namespace, list);
}
diff --git a/src/Generators/Microsoft.Gen.Metrics/MetricFactoryEmitter.cs b/src/Generators/Microsoft.Gen.Metrics/MetricFactoryEmitter.cs
index 520ef59f5de..531095d0c85 100644
--- a/src/Generators/Microsoft.Gen.Metrics/MetricFactoryEmitter.cs
+++ b/src/Generators/Microsoft.Gen.Metrics/MetricFactoryEmitter.cs
@@ -16,12 +16,12 @@ internal sealed class MetricFactoryEmitter : EmitterBase
{
public string Emit(IReadOnlyList metricClasses, CancellationToken cancellationToken)
{
- Dictionary> metricClassesDict = new();
+ Dictionary> metricClassesDict = [];
foreach (var cl in metricClasses)
{
if (!metricClassesDict.TryGetValue(cl.Namespace, out var list))
{
- list = new List();
+ list = [];
metricClassesDict.Add(cl.Namespace, list);
}
diff --git a/src/Libraries/Directory.Build.props b/src/Libraries/Directory.Build.props
index 73171854d92..518a00ad5b8 100644
--- a/src/Libraries/Directory.Build.props
+++ b/src/Libraries/Directory.Build.props
@@ -3,7 +3,7 @@
$(NetCoreTargetFrameworks)$(ConditionalNet462)
- true
+ true
true
true
diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Microsoft.Extensions.Compliance.Abstractions.csproj b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Microsoft.Extensions.Compliance.Abstractions.csproj
index 20731ba1c39..f33d2b8b8ad 100644
--- a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Microsoft.Extensions.Compliance.Abstractions.csproj
+++ b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Microsoft.Extensions.Compliance.Abstractions.csproj
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj
index 38726989d7a..1883b86af55 100644
--- a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj
+++ b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj
@@ -25,7 +25,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/Microsoft.Extensions.Diagnostics.ExceptionSummarization.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/Microsoft.Extensions.Diagnostics.ExceptionSummarization.csproj
index 5d49c87228b..ba9c6dbd3b3 100644
--- a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/Microsoft.Extensions.Diagnostics.ExceptionSummarization.csproj
+++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/Microsoft.Extensions.Diagnostics.ExceptionSummarization.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj
index 8fd7e5394a5..f9999a03175 100644
--- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj
+++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Http.AutoClient/Microsoft.Extensions.Http.AutoClient.csproj b/src/Libraries/Microsoft.Extensions.Http.AutoClient/Microsoft.Extensions.Http.AutoClient.csproj
index cd8c938d274..ab78fe846fc 100644
--- a/src/Libraries/Microsoft.Extensions.Http.AutoClient/Microsoft.Extensions.Http.AutoClient.csproj
+++ b/src/Libraries/Microsoft.Extensions.Http.AutoClient/Microsoft.Extensions.Http.AutoClient.csproj
@@ -34,7 +34,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionContextMessageHandler.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionContextMessageHandler.cs
index c417c913536..cede486ebc2 100644
--- a/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionContextMessageHandler.cs
+++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionContextMessageHandler.cs
@@ -24,7 +24,7 @@ protected override Task SendAsync(HttpRequestMessage reques
if (context == null)
{
- context = new Context();
+ context = [];
request.SetPolicyExecutionContext(context);
}
diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandler.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandler.cs
index a9b57268043..9f855406f64 100644
--- a/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandler.cs
+++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandler.cs
@@ -25,7 +25,7 @@ protected override Task SendAsync(HttpRequestMessage reques
if (context == null)
{
- context = new Context();
+ context = [];
request.SetPolicyExecutionContext(context);
}
diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpRequestMessageExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpRequestMessageExtensions.cs
index ee03d1f7199..de2e73881db 100644
--- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpRequestMessageExtensions.cs
+++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpRequestMessageExtensions.cs
@@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Http.Resilience;
///
public static class HttpRequestMessageExtensions
{
-#if NET8_0_OR_GREATER
+#if NET6_0_OR_GREATER
private static readonly HttpRequestOptionsKey _resilienceContextKey = new("Resilience.Http.ResilienceContext");
#else
private const string ResilienceContextKey = "Resilience.Http.ResilienceContext";
@@ -27,7 +27,7 @@ public static class HttpRequestMessageExtensions
{
_ = Throw.IfNull(requestMessage);
-#if NET8_0_OR_GREATER
+#if NET6_0_OR_GREATER
if (requestMessage.Options.TryGetValue(_resilienceContextKey, out var context))
{
return context;
@@ -50,7 +50,7 @@ public static class HttpRequestMessageExtensions
public static void SetResilienceContext(this HttpRequestMessage requestMessage, ResilienceContext? resilienceContext)
{
_ = Throw.IfNull(requestMessage);
-#if NET8_0_OR_GREATER
+#if NET6_0_OR_GREATER
requestMessage.Options.Set(_resilienceContextKey, resilienceContext);
#else
requestMessage.Properties[ResilienceContextKey] = resilienceContext;
diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/WeightedGroups/WeightedGroupsRoutingStrategy.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/WeightedGroups/WeightedGroupsRoutingStrategy.cs
index 4b767bc1c49..dae21f0cd49 100644
--- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/WeightedGroups/WeightedGroupsRoutingStrategy.cs
+++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/WeightedGroups/WeightedGroupsRoutingStrategy.cs
@@ -21,7 +21,7 @@ internal sealed class WeightedGroupsRoutingStrategy : RequestRoutingStrategy
public WeightedGroupsRoutingStrategy(Randomizer randomizer, ObjectPool pool)
: base(randomizer)
{
- _groups = new List();
+ _groups = [];
_pool = pool;
}
diff --git a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Latency/Internal/HttpRequestLatencyListener.cs b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Latency/Internal/HttpRequestLatencyListener.cs
index 8f38fe3c1d4..b99045e53bf 100644
--- a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Latency/Internal/HttpRequestLatencyListener.cs
+++ b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Latency/Internal/HttpRequestLatencyListener.cs
@@ -121,19 +121,19 @@ private sealed class EventToCheckpointToken
public EventToCheckpointToken(ILatencyContextTokenIssuer tokenIssuer)
{
- Dictionary socket = new();
+ Dictionary socket = [];
foreach (string key in _socketMap.Keys)
{
socket[key] = tokenIssuer.GetCheckpointToken(_socketMap[key]);
}
- Dictionary nameResolution = new();
+ Dictionary nameResolution = [];
foreach (string key in _nameResolutionMap.Keys)
{
nameResolution[key] = tokenIssuer.GetCheckpointToken(_nameResolutionMap[key]);
}
- Dictionary http = new();
+ Dictionary http = [];
foreach (string key in _httpMap.Keys)
{
http[key] = tokenIssuer.GetCheckpointToken(_httpMap[key]);
diff --git a/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj
index 6a5f5c7de2a..17edd6e9603 100644
--- a/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj
+++ b/src/Libraries/Microsoft.Extensions.Resilience/Microsoft.Extensions.Resilience.csproj
@@ -35,7 +35,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj
index 779b8822121..0e16deda969 100644
--- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj
+++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj
@@ -27,7 +27,7 @@
-
<_AdditionalNETStandardCompatErrorFileContents>
@@ -49,7 +49,7 @@
-
+
diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry/DownstreamDependencyMetadataManager.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry/DownstreamDependencyMetadataManager.cs
index 03f576133d0..0ac26227257 100644
--- a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry/DownstreamDependencyMetadataManager.cs
+++ b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry/DownstreamDependencyMetadataManager.cs
@@ -30,7 +30,7 @@ internal readonly struct ProcessedMetadata
public DownstreamDependencyMetadataManager(IEnumerable downstreamDependencyMetadata)
{
- Dictionary dependencyTrieMap = new();
+ Dictionary dependencyTrieMap = [];
foreach (var dependency in downstreamDependencyMetadata)
{
AddDependency(dependency, dependencyTrieMap);
@@ -153,7 +153,7 @@ private static void AddRouteToTrie(RequestMetadata routeMetadata, Dictionary ProcessDownstreamDependencyMetadata(Dictionary dependencyTrieMap)
{
- Dictionary finalArrayDict = new();
+ Dictionary finalArrayDict = [];
foreach (var dep in dependencyTrieMap)
{
var finalArray = ProcessDownstreamDependencyMetadataInternal(dep.Value);
diff --git a/src/Shared/Shared.csproj b/src/Shared/Shared.csproj
index 5f5a87a4b28..ed668a5200b 100644
--- a/src/Shared/Shared.csproj
+++ b/src/Shared/Shared.csproj
@@ -26,12 +26,12 @@
-
+
-
-
+
+
diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs
index 04d8a241387..bb27a76eb2f 100644
--- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs
+++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs
@@ -106,9 +106,7 @@ public Arg(TParameter arg1)
null,
new[] { Source }).ConfigureAwait(false);
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
Assert.Equal(8, d.Count);
for (int i = 0; i < d.Count; i++)
{
diff --git a/test/Generators/Microsoft.Gen.EnumStrings/Generated/Microsoft.Gen.EnumStrings.Generated.Tests.csproj b/test/Generators/Microsoft.Gen.EnumStrings/Generated/Microsoft.Gen.EnumStrings.Generated.Tests.csproj
index bc417eceecd..80febbdb554 100644
--- a/test/Generators/Microsoft.Gen.EnumStrings/Generated/Microsoft.Gen.EnumStrings.Generated.Tests.csproj
+++ b/test/Generators/Microsoft.Gen.EnumStrings/Generated/Microsoft.Gen.EnumStrings.Generated.Tests.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj
index 5f780790a0d..9f2ab23c251 100644
--- a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj
+++ b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj
@@ -3,7 +3,7 @@
Microsoft.AspNetCore.AsyncState.Test
Unit tests for Microsoft.AspNetCore.AsyncState.
- true
+ true
diff --git a/test/Libraries/Microsoft.AspNetCore.Telemetry.Tests/Microsoft.AspNetCore.Telemetry.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.Telemetry.Tests/Microsoft.AspNetCore.Telemetry.Tests.csproj
index c2db882e0e0..0778c087009 100644
--- a/test/Libraries/Microsoft.AspNetCore.Telemetry.Tests/Microsoft.AspNetCore.Telemetry.Tests.csproj
+++ b/test/Libraries/Microsoft.AspNetCore.Telemetry.Tests/Microsoft.AspNetCore.Telemetry.Tests.csproj
@@ -14,14 +14,14 @@
-
+
-
+
diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Redaction/RedactorTest.cs b/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Redaction/RedactorTest.cs
index 57a57f21981..e6c044b3b00 100644
--- a/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Redaction/RedactorTest.cs
+++ b/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Redaction/RedactorTest.cs
@@ -68,9 +68,7 @@ public static void Redact_Extension_String_Span_Works_The_Same_Way_As_Native_Met
Assert.Equal(extBuffer.ToString(), buffer.ToString());
}
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
[Theory]
[InlineData(100)]
[InlineData(1000)]
diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/Resources/HardcodedValueFileSystem.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/Resources/HardcodedValueFileSystem.cs
index 9bdc38f8fa3..19bc8a792e0 100644
--- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/Resources/HardcodedValueFileSystem.cs
+++ b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/Resources/HardcodedValueFileSystem.cs
@@ -19,7 +19,7 @@ internal sealed class HardcodedValueFileSystem : IFileSystem
public HardcodedValueFileSystem(string fallback)
{
_fallback = fallback;
- _fileContent = new();
+ _fileContent = [];
}
public HardcodedValueFileSystem(Dictionary fileContent, string fallback = "")
diff --git a/test/Libraries/Microsoft.Extensions.Http.AutoClient.Tests/Microsoft.Extensions.Http.AutoClient.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.AutoClient.Tests/Microsoft.Extensions.Http.AutoClient.Tests.csproj
index d71eadd7251..8cec982fe0a 100644
--- a/test/Libraries/Microsoft.Extensions.Http.AutoClient.Tests/Microsoft.Extensions.Http.AutoClient.Tests.csproj
+++ b/test/Libraries/Microsoft.Extensions.Http.AutoClient.Tests/Microsoft.Extensions.Http.AutoClient.Tests.csproj
@@ -9,6 +9,6 @@
-
+
diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/HttpStandardHedgingResilienceOptionsCustomValidatorTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/HttpStandardHedgingResilienceOptionsCustomValidatorTests.cs
index e03af3edefd..bb3541e81fe 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/HttpStandardHedgingResilienceOptionsCustomValidatorTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/HttpStandardHedgingResilienceOptionsCustomValidatorTests.cs
@@ -23,9 +23,7 @@ public void Validate_InvalidOptions_EnsureValidationErrors()
Assert.True(validationResult.Failed);
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
validationResult.Failures.Should().HaveCount(3);
#endif
}
diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs
index c5030c7bb72..6ce2854ae5c 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs
@@ -121,9 +121,7 @@ public void ActionGenerator_Ok()
generator.Invoking(g => g(args)).Should().NotThrow();
}
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
[Fact]
public void Configure_InvalidConfigurationSection_ShouldThrow()
{
diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj
index 6ed84e2ed73..3d96980ba3f 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj
+++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj
@@ -30,7 +30,7 @@
-
+
diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpStandardResilienceOptionsCustomValidatorTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpStandardResilienceOptionsCustomValidatorTests.cs
index b322d6a0e13..8519d916682 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpStandardResilienceOptionsCustomValidatorTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpStandardResilienceOptionsCustomValidatorTests.cs
@@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
-#if NET8_0_OR_GREATER
+#if NET6_0_OR_GREATER
using System.Linq;
using Microsoft;
using Microsoft.Extensions;
@@ -29,9 +29,7 @@ public void Validate_InvalidOptions_EnsureValidationErrors()
Assert.True(validationResult.Failed);
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
Assert.Equal(2, validationResult.Failures.Count());
#endif
}
diff --git a/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Microsoft.Extensions.Http.Telemetry.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Microsoft.Extensions.Http.Telemetry.Tests.csproj
index 3f4fd98c42f..c9d22f950f0 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Microsoft.Extensions.Http.Telemetry.Tests.csproj
+++ b/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Microsoft.Extensions.Http.Telemetry.Tests.csproj
@@ -25,7 +25,7 @@
-
+
diff --git a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/OptionsValidationTests.cs b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/OptionsValidationTests.cs
index e83c2ca86f2..82fb790b6ea 100644
--- a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/OptionsValidationTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/OptionsValidationTests.cs
@@ -134,7 +134,7 @@ public void GenerateFailureMessages_NullErrorMessages_ShouldReturnUnknownError()
{
var results = new List
{
- new ValidationResult(null!)
+ new(null!)
};
var messages = FaultInjectionOptionsValidator.GenerateFailureMessages(results);
diff --git a/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj b/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj
index f05cef18480..89a9d00ca75 100644
--- a/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj
+++ b/test/Libraries/Microsoft.Extensions.Resilience.Tests/Microsoft.Extensions.Resilience.Tests.csproj
@@ -27,8 +27,8 @@
-
-
+
+
diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogMethodHelperTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogMethodHelperTests.cs
index 1b4cd1f503e..d8459b9732f 100644
--- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogMethodHelperTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogMethodHelperTests.cs
@@ -111,9 +111,7 @@ public static void Pool()
LogMethodHelper.ReturnHelper(list);
}
-#if NET8_0_OR_GREATER
- // Whilst LogMethodHelper.SkipEnabledCheckOptions is marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
[Fact]
public static void Options()
{
diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageHelperTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageHelperTests.cs
index 4cb77f2c841..e5adb915a93 100644
--- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageHelperTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageHelperTests.cs
@@ -72,9 +72,7 @@ public static void ThreadLocal()
Assert.Same(lmp1, lmp2);
}
-#if NET8_0_OR_GREATER
- // Whilst LogMethodHelper.SkipEnabledCheckOptions is marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
[Fact]
public static void Options()
{
diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerTests.cs
index c3fbfd39afa..fa470094305 100644
--- a/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerTests.cs
@@ -75,10 +75,10 @@ public void State()
var l = new List>
{
- new KeyValuePair("K0", "V0"),
- new KeyValuePair("K1", "V1"),
- new KeyValuePair("K2", null),
- new KeyValuePair("K3", new[] { 0, 1, 2 }),
+ new("K0", "V0"),
+ new("K1", "V1"),
+ new("K2", null),
+ new("K3", new[] { 0, 1, 2 }),
};
logger.Log(LogLevel.Debug, new EventId(1), l, null, (_, _) => "Nothing");
@@ -118,7 +118,7 @@ public void StateInvariant()
var l = new List>
{
- new KeyValuePair("K0", dt),
+ new("K0", dt),
};
logger.Log(LogLevel.Debug, new EventId(1), l, null, (_, _) => "Nothing");
diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs
index 9b0b4050afd..0454d15d826 100644
--- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs
+++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs
@@ -399,7 +399,7 @@ public static void Exceptions()
Exception ex;
try
{
- List exceptions = new();
+ List exceptions = [];
try
{
throw new ArgumentNullException("ARG1");
diff --git a/test/Shared/Data.Validation/LengthAttributeTests.cs b/test/Shared/Data.Validation/LengthAttributeTests.cs
index d517b9a7685..1504d3288aa 100644
--- a/test/Shared/Data.Validation/LengthAttributeTests.cs
+++ b/test/Shared/Data.Validation/LengthAttributeTests.cs
@@ -344,22 +344,22 @@ public void BadAttributeUse()
var options1 = new BadOptions1();
context = new ValidationContext(options1);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options1, context, results, true));
var options2 = new BadOptions2();
context = new ValidationContext(options2);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options2, context, results, true));
var options3 = new BadOptions3();
context = new ValidationContext(options3);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options3, context, results, true));
var options4 = new BadOptions4();
context = new ValidationContext(options4);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options4, context, results, true));
}
diff --git a/test/Shared/Data.Validation/TimeSpanAttributeTests.cs b/test/Shared/Data.Validation/TimeSpanAttributeTests.cs
index b7f535ec280..fca13c80a77 100644
--- a/test/Shared/Data.Validation/TimeSpanAttributeTests.cs
+++ b/test/Shared/Data.Validation/TimeSpanAttributeTests.cs
@@ -231,12 +231,12 @@ public void BadAttributeUse()
var options1 = new BadOptions1();
context = new ValidationContext(options1);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options1, context, results, true));
var options3 = new BadOptions3();
context = new ValidationContext(options3);
- results = new List();
+ results = [];
Assert.Throws(() => _ = Validator.TryValidateObject(options3, context, results, true));
}
diff --git a/test/Shared/Pools/PoolTests.cs b/test/Shared/Pools/PoolTests.cs
index dd9190674fa..b871bca219b 100644
--- a/test/Shared/Pools/PoolTests.cs
+++ b/test/Shared/Pools/PoolTests.cs
@@ -197,9 +197,7 @@ public void CancellationTokenSourcePool_NotTriggered()
pool.Return(s);
var s2 = pool.Get();
-#if NET8_0_OR_GREATER
- // Whilst these API are marked as NET6_0_OR_GREATER we don't build .NET 6.0,
- // and as such the API is available in .NET 8 onwards.
+#if NET6_0_OR_GREATER
Assert.Same(s, s2);
#else
Assert.NotSame(s, s2);
diff --git a/test/Shared/Shared.Tests.csproj b/test/Shared/Shared.Tests.csproj
index be943be59c6..3d423d264f9 100644
--- a/test/Shared/Shared.Tests.csproj
+++ b/test/Shared/Shared.Tests.csproj
@@ -10,11 +10,6 @@
$(TestNetCoreTargetFrameworks)$(ConditionalNet462)
-
-
- true
-
-