Skip to content

[release/9.0-preview4] Update dependencies from dotnet/efcore, dotnet/runtime #55372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -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
316 changes: 158 additions & 158 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions eng/Versions.props

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions eng/tools/RepoTasks/RemoveSharedFrameworkDependencies.cs
Original file line number Diff line number Diff line change
@@ -64,12 +64,17 @@ private void FilterDependencies(string targetPath, ISet<string> 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<string> dependencyToRemo
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
}

/// <summary>
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ public static IEnumerable<SelectorModel> 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--)
5 changes: 2 additions & 3 deletions src/Servers/Kestrel/Core/src/KestrelServerOptions.cs
Original file line number Diff line number Diff line change
@@ -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();
18 changes: 14 additions & 4 deletions src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs
Original file line number Diff line number Diff line change
@@ -829,12 +829,22 @@ private void LaunchStreams(ConnectionState connectionState, Dictionary<string, o
{
_ = _sendIAsyncStreamItemsMethod
.MakeGenericMethod(reader.GetType().GetInterface("IAsyncEnumerable`1")!.GetGenericArguments())
.Invoke(this, new object[] { connectionState, kvp.Key.ToString(), reader, cts });
.Invoke(this, [connectionState, kvp.Key.ToString(), reader, cts]);
continue;
}
_ = _sendStreamItemsMethod
.MakeGenericMethod(reader.GetType().GetGenericArguments())
.Invoke(this, new object[] { connectionState, kvp.Key.ToString(), reader, cts });
else
{
if (ReflectionHelper.TryGetStreamType(reader.GetType(), out var channelGenericType))
{
_ = _sendStreamItemsMethod
.MakeGenericMethod(channelGenericType)
.Invoke(this, [connectionState, kvp.Key.ToString(), reader, cts]);
continue;
}

// Should never get here, we should have already verified the stream types when the user initially calls send/invoke
throw new InvalidOperationException($"{reader.GetType()} is not a {typeof(ChannelReader<>).Name}.");
}
}
}

10 changes: 10 additions & 0 deletions src/SignalR/common/Shared/ReflectionHelper.cs
Original file line number Diff line number Diff line change
@@ -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<Type, Type> _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);
}