diff --git a/.editorconfig b/.editorconfig index 5917bfd42998..d3abbaddfe8a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -147,7 +147,7 @@ dotnet_diagnostic.CA1823.severity = warning dotnet_diagnostic.CA1825.severity = warning # CA1826: Do not use Enumerable methods on indexable collections. Instead use the collection directly -dotnet_diagnostic.CA1826.severity = warning +dotnet_diagnostic.CA1826.severity = suggestion # CA1827: Do not use Count() or LongCount() when Any() can be used dotnet_diagnostic.CA1827.severity = warning diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8733644514f5..41a6e0ae4bbe 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,321 +9,321 @@ --> - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/efcore - cbe3722146e65dee94bc893287e7b251d79dffe2 + f8b7236443f9c9fc2a466f359a1d01cd161cbc4b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b https://github.com/dotnet/xdt @@ -363,9 +363,9 @@ afa1eb6821f62183651ab017b2f5c3fbeb934904 - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b @@ -376,9 +376,9 @@ - + https://github.com/dotnet/runtime - 5111fdc0dc464f01647d6b6078342f451bf3a499 + 274daa158a78f05279bf523e806ea2311972910b https://github.com/dotnet/winforms diff --git a/eng/Versions.props b/eng/Versions.props index 6e387a477806..0bbf98b8eb83 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,91 +63,91 @@ --> - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 - 9.0.0-preview.4.24222.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 + 9.0.0-preview.4.24230.10 9.0.0-preview.4.24220.1 9.0.0-preview.4.24220.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 - 9.0.0-preview.5.24223.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 + 9.0.0-preview.4.24226.1 4.11.0-1.24218.5 4.11.0-1.24218.5 diff --git a/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs b/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs index e29e25581607..6f42d05e78c5 100644 --- a/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs +++ b/eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs @@ -64,12 +64,17 @@ private void FilterDependencies(string targetPath, ISet dependencyToRemo var updatedGroup = new PackageDependencyGroup(group.TargetFramework, packages); foreach (var dependency in group.Packages) { - if (dependencyToRemove.Contains(dependency.Id)) + // Hack to temporarily avoid using ISet.Contains + if (!dependencyToRemove.Add(dependency.Id)) { referencesFrameworkOnlyAssembly = true; Log.LogMessage($" Remove dependency on '{dependency.Id}'"); continue; } + else + { + dependencyToRemove.Remove(dependency.Id); + } packages.Add(dependency); } @@ -107,4 +112,4 @@ private void FilterDependencies(string targetPath, ISet dependencyToRemo } } } -} +} \ No newline at end of file diff --git a/src/Identity/Specification.Tests/src/UserManagerSpecificationTests.cs b/src/Identity/Specification.Tests/src/UserManagerSpecificationTests.cs index 317f6ee93b13..4031bf5f2ba9 100644 --- a/src/Identity/Specification.Tests/src/UserManagerSpecificationTests.cs +++ b/src/Identity/Specification.Tests/src/UserManagerSpecificationTests.cs @@ -581,9 +581,9 @@ public async Task CanCreateUserAddLogin() var logins = await manager.GetLoginsAsync(user); Assert.NotNull(logins); Assert.Single(logins); - Assert.Equal(provider, logins.First().LoginProvider); - Assert.Equal(providerKey, logins.First().ProviderKey); - Assert.Equal(display, logins.First().ProviderDisplayName); + Assert.Equal(provider, logins[0].LoginProvider); + Assert.Equal(providerKey, logins[0].ProviderKey); + Assert.Equal(display, logins[0].ProviderDisplayName); } /// @@ -644,9 +644,9 @@ public async Task CanCreateUserAddRemoveLogin() var logins = await manager.GetLoginsAsync(user); Assert.NotNull(logins); Assert.Single(logins); - Assert.Equal(login.LoginProvider, logins.Last().LoginProvider); - Assert.Equal(login.ProviderKey, logins.Last().ProviderKey); - Assert.Equal(login.ProviderDisplayName, logins.Last().ProviderDisplayName); + Assert.Equal(login.LoginProvider, logins[^1].LoginProvider); + Assert.Equal(login.ProviderKey, logins[^1].ProviderKey); + Assert.Equal(login.ProviderDisplayName, logins[^1].ProviderDisplayName); var stamp = await manager.GetSecurityStampAsync(user); IdentityResultAssert.IsSuccess(await manager.RemoveLoginAsync(user, login.LoginProvider, login.ProviderKey)); Assert.Null(await manager.FindByLoginAsync(login.LoginProvider, login.ProviderKey)); @@ -772,11 +772,11 @@ public async Task CanReplaceUserClaim() var userClaims = await manager.GetClaimsAsync(user); Assert.Equal(1, userClaims.Count); Claim claim = new Claim("c", "b"); - Claim oldClaim = userClaims.FirstOrDefault(); + Claim oldClaim = userClaims.Count == 0 ? null : userClaims[0]; IdentityResultAssert.IsSuccess(await manager.ReplaceClaimAsync(user, oldClaim, claim)); var newUserClaims = await manager.GetClaimsAsync(user); Assert.Equal(1, newUserClaims.Count); - Claim newClaim = newUserClaims.FirstOrDefault(); + Claim newClaim = newUserClaims.Count == 0 ? null : newUserClaims[0]; Assert.Equal(claim.Type, newClaim.Type); Assert.Equal(claim.Value, newClaim.Value); } @@ -800,16 +800,16 @@ public async Task ReplaceUserClaimOnlyAffectsUser() var userClaims2 = await manager.GetClaimsAsync(user); Assert.Equal(1, userClaims2.Count); Claim claim = new Claim("c", "b"); - Claim oldClaim = userClaims.FirstOrDefault(); + Claim oldClaim = userClaims.Count == 0 ? null : userClaims[0]; IdentityResultAssert.IsSuccess(await manager.ReplaceClaimAsync(user, oldClaim, claim)); var newUserClaims = await manager.GetClaimsAsync(user); Assert.Equal(1, newUserClaims.Count); - Claim newClaim = newUserClaims.FirstOrDefault(); + Claim newClaim = newUserClaims.Count == 0 ? null : newUserClaims[0]; Assert.Equal(claim.Type, newClaim.Type); Assert.Equal(claim.Value, newClaim.Value); userClaims2 = await manager.GetClaimsAsync(user2); Assert.Equal(1, userClaims2.Count); - Claim oldClaim2 = userClaims2.FirstOrDefault(); + Claim oldClaim2 = userClaims2.Count == 0 ? null : userClaims2[0]; Assert.Equal("c", oldClaim2.Type); Assert.Equal("a", oldClaim2.Value); } diff --git a/src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs b/src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs index 235ac3583fa0..5afa959e0fb5 100644 --- a/src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs +++ b/src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs @@ -31,7 +31,7 @@ public static IEnumerable FlattenSelectors(ActionModel actionMode // // This is fragile wrt application model customizing the data - but no one has // run into an issue with this and its pretty esoteric. - additionalSelector = new SelectorModel(actionModel.Controller.Selectors.First()); + additionalSelector = new SelectorModel(actionModel.Controller.Selectors[0]); additionalSelector.AttributeRouteModel = null; for (var i = additionalSelector.ActionConstraints.Count - 1; i >= 0; i--) diff --git a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs index c2670be70067..f16b35437001 100644 --- a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs +++ b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; -using System.Linq; using System.Net; using System.Security.Cryptography.X509Certificates; using System.Text; @@ -376,9 +375,9 @@ internal void Serialize(Utf8JsonWriter writer) { try { - var cert = CertificateManager.Instance.ListCertificates(StoreName.My, StoreLocation.CurrentUser, isValid: true, requireExportable: false) - .FirstOrDefault(); + var certs = CertificateManager.Instance.ListCertificates(StoreName.My, StoreLocation.CurrentUser, isValid: true, requireExportable: false); + var cert = certs.Count > 0 ? certs[0] : null; if (cert is null) { logger.UnableToLocateDevelopmentCertificate(); diff --git a/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs b/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs index 3c26969c1cb7..4190541ca246 100644 --- a/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs +++ b/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs @@ -829,12 +829,22 @@ private void LaunchStreams(ConnectionState connectionState, Dictionary).Name}."); + } } } diff --git a/src/SignalR/common/Shared/ReflectionHelper.cs b/src/SignalR/common/Shared/ReflectionHelper.cs index 25edb5d8dcdb..635653922b14 100644 --- a/src/SignalR/common/Shared/ReflectionHelper.cs +++ b/src/SignalR/common/Shared/ReflectionHelper.cs @@ -2,7 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Channels; @@ -11,6 +13,8 @@ namespace Microsoft.AspNetCore.SignalR; internal static class ReflectionHelper { + private static readonly ConcurrentDictionary _streamTypeLookup = new(); + // mustBeDirectType - Hub methods must use the base 'stream' type and not be a derived class that just implements the 'stream' type // and 'stream' types from the client are allowed to inherit from accepted 'stream' types public static bool IsStreamingType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] Type type, bool mustBeDirectType = false) @@ -28,6 +32,9 @@ public static bool IsStreamingType([DynamicallyAccessedMembers(DynamicallyAccess { if (nullableType.IsGenericType && nullableType.GetGenericTypeDefinition() == typeof(ChannelReader<>)) { + Debug.Assert(nullableType.GetGenericArguments().Length == 1); + + _streamTypeLookup.GetOrAdd(type, nullableType.GetGenericArguments()[0]); return true; } @@ -59,4 +66,7 @@ public static bool IsIAsyncEnumerable([DynamicallyAccessedMembers(DynamicallyAcc } }); } + + public static bool TryGetStreamType(Type stream, [NotNullWhen(true)] out Type? streamType) + => _streamTypeLookup.TryGetValue(stream, out streamType); }