Use expression body properties and implicit arrays where possible (#1906)
This commit is contained in:
parent
0f663cadc4
commit
27d18578d0
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
|
|||
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "Foo", 2.0f);
|
||||
break;
|
||||
case Message.ManyArguments:
|
||||
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "string", 2.0f, true, (byte)9, new int[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L);
|
||||
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "string", 2.0f, true, (byte)9, new[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L);
|
||||
break;
|
||||
case Message.LargeArguments:
|
||||
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, new string('F', 10240), new string('B', 10240));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ namespace System.Threading.Tasks
|
|||
|
||||
public ForceAsyncAwaiter GetAwaiter() { return this; }
|
||||
|
||||
public bool IsCompleted { get { return false; } } // the purpose of this type is to always force a continuation
|
||||
// The purpose of this type is to always force a continuation
|
||||
public bool IsCompleted => false;
|
||||
|
||||
public void GetResult() { _task.GetAwaiter().GetResult(); }
|
||||
|
||||
|
|
@ -57,7 +58,8 @@ namespace System.Threading.Tasks
|
|||
|
||||
public ForceAsyncAwaiter<T> GetAwaiter() { return this; }
|
||||
|
||||
public bool IsCompleted { get { return false; } } // the purpose of this type is to always force a continuation
|
||||
// The purpose of this type is to always force a continuation
|
||||
public bool IsCompleted => false;
|
||||
|
||||
public T GetResult() { return _task.GetAwaiter().GetResult(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -56,10 +56,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
|
|||
}
|
||||
return _transport;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException("The transport pipe isn't settable.");
|
||||
}
|
||||
set => throw new NotSupportedException("The transport pipe isn't settable.");
|
||||
}
|
||||
|
||||
public override IFeatureCollection Features { get; } = new FeatureCollection();
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
|
||||
public string ConnectionId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _connectionId;
|
||||
}
|
||||
get => _connectionId;
|
||||
set
|
||||
{
|
||||
_cachedToString = null;
|
||||
|
|
|
|||
|
|
@ -97,10 +97,7 @@ namespace Microsoft.AspNetCore.Http.Connections
|
|||
|
||||
public IDuplexPipe Application
|
||||
{
|
||||
get
|
||||
{
|
||||
return _application;
|
||||
}
|
||||
get => _application;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
|
|||
{
|
||||
public static class ServerSentEventsMessageFormatter
|
||||
{
|
||||
private static readonly byte[] DataPrefix = new byte[] { (byte)'d', (byte)'a', (byte)'t', (byte)'a', (byte)':', (byte)' ' };
|
||||
private static readonly byte[] Newline = new byte[] { (byte)'\r', (byte)'\n' };
|
||||
private static readonly byte[] DataPrefix = new[] { (byte)'d', (byte)'a', (byte)'t', (byte)'a', (byte)':', (byte)' ' };
|
||||
private static readonly byte[] Newline = new[] { (byte)'\r', (byte)'\n' };
|
||||
|
||||
private const byte LineFeed = (byte)'\n';
|
||||
|
||||
|
|
|
|||
|
|
@ -18,52 +18,52 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object[] args, CancellationToken cancellationToken = default)
|
||||
|
|
|
|||
|
|
@ -18,52 +18,52 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
return hubConnection.InvokeAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static async Task<TResult> InvokeAsync<TResult>(this HubConnection hubConnection, string methodName, object[] args, CancellationToken cancellationToken = default)
|
||||
|
|
|
|||
|
|
@ -16,52 +16,52 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task SendAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.SendAsync(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
return hubConnection.SendAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,52 +17,52 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
return hubConnection.StreamAsChannelAsync<TResult>(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
|
||||
}
|
||||
|
||||
public static async Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object[] args, CancellationToken cancellationToken = default)
|
||||
|
|
|
|||
|
|
@ -27,13 +27,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
|
|||
}
|
||||
}
|
||||
|
||||
public Exception ArgumentBindingException
|
||||
{
|
||||
get
|
||||
{
|
||||
return _argumentBindingException?.SourceException;
|
||||
}
|
||||
}
|
||||
public Exception ArgumentBindingException => _argumentBindingException?.SourceException;
|
||||
|
||||
protected HubMethodInvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, object[] arguments)
|
||||
: base(invocationId)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,16 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
|
||||
public new DynamicHubClients Clients
|
||||
{
|
||||
get { return _clients ?? new DynamicHubClients(base.Clients); }
|
||||
set { _clients = value; }
|
||||
get
|
||||
{
|
||||
if (_clients == null)
|
||||
{
|
||||
_clients = new DynamicHubClients(base.Clients);
|
||||
}
|
||||
|
||||
return _clients;
|
||||
}
|
||||
set => _clients = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
{
|
||||
_connectionId = connectionId;
|
||||
_hubClients = hubClients;
|
||||
_currentConnectionId = new string[] { _connectionId };
|
||||
_currentConnectionId = new[] { _connectionId };
|
||||
}
|
||||
|
||||
public IClientProxy Caller => _hubClients.Client(_connectionId);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
}
|
||||
return _clients;
|
||||
}
|
||||
set { _clients = value; }
|
||||
set => _clients = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -169,7 +169,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -191,7 +191,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
/// <returns>A task that represents when the data has been sent to the client.</returns>
|
||||
public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10)
|
||||
{
|
||||
return clientProxy.SendCoreAsync(method, new object[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 });
|
||||
return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.SignalR
|
|||
|
||||
var invokeMethod = typeof(IClientProxy).GetMethod(
|
||||
nameof(IClientProxy.SendCoreAsync), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null,
|
||||
new Type[] { typeof(string), typeof(object[]) }, null);
|
||||
new[] { typeof(string), typeof(object[]) }, null);
|
||||
|
||||
methodBuilder.SetReturnType(interfaceMethodInfo.ReturnType);
|
||||
methodBuilder.SetParameters(paramTypes);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
await dispatcher.ExecuteAsync(context, options, c => Task.CompletedTask);
|
||||
|
||||
// This write should complete immediately but it exceeds the writer threshold
|
||||
var writeTask = connection.Application.Output.WriteAsync(new byte[] { (byte)'b', (byte)'y', (byte)'t', (byte)'e', (byte)'s' });
|
||||
var writeTask = connection.Application.Output.WriteAsync(new[] { (byte)'b', (byte)'y', (byte)'t', (byte)'e', (byte)'s' });
|
||||
|
||||
Assert.False(writeTask.IsCompleted);
|
||||
|
||||
|
|
@ -1651,7 +1651,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
private HttpContext HttpContext;
|
||||
private AuthenticationScheme _scheme;
|
||||
|
||||
protected virtual bool ShouldAccept { get => true; }
|
||||
protected virtual bool ShouldAccept => true;
|
||||
|
||||
public Task<AuthenticateResult> AuthenticateAsync()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
{
|
||||
await connection.StartAsync().OrTimeout();
|
||||
|
||||
var ex = await Assert.ThrowsAsync<HubException>(() => connection.InvokeAsync("Echo", new int[] { 42 })).OrTimeout();
|
||||
var ex = await Assert.ThrowsAsync<HubException>(() => connection.InvokeAsync("Echo", new[] { 42 })).OrTimeout();
|
||||
Assert.StartsWith("Failed to invoke 'Echo' due to an error on the server.", ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task LongPollingTransportDispatchesMessagesReceivedFromPoll()
|
||||
{
|
||||
var message1Payload = new byte[] { (byte)'H', (byte)'e', (byte)'l', (byte)'l', (byte)'o' };
|
||||
var message1Payload = new[] { (byte)'H', (byte)'e', (byte)'l', (byte)'l', (byte)'o' };
|
||||
|
||||
var firstCall = true;
|
||||
var mockHttpHandler = new Mock<HttpMessageHandler>();
|
||||
|
|
@ -337,7 +337,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
await longPollingTransport.Input.ReadAllAsync();
|
||||
|
||||
Assert.Single(sentRequests);
|
||||
Assert.Equal(new byte[] { (byte)'H', (byte)'e', (byte)'l', (byte)'l', (byte)'o', (byte)'W', (byte)'o', (byte)'r', (byte)'l', (byte)'d'
|
||||
Assert.Equal(new[] { (byte)'H', (byte)'e', (byte)'l', (byte)'l', (byte)'o', (byte)'W', (byte)'o', (byte)'r', (byte)'l', (byte)'d'
|
||||
}, sentRequests[0]);
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
|
|
@ -12,13 +12,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public class WebSocketsSupportedConditionAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet
|
||||
{
|
||||
get
|
||||
{
|
||||
return TestHelpers.IsWebSocketsSupported();
|
||||
}
|
||||
}
|
||||
public bool IsMet => TestHelpers.IsWebSocketsSupported();
|
||||
|
||||
public string SkipReason => "No WebSockets Client for this platform";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -872,7 +872,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
Assert.Equal("Array", invocation.Target);
|
||||
Assert.Single(invocation.Arguments);
|
||||
var values = ((JArray)invocation.Arguments[0]).Select(t => t.Value<int>()).ToArray();
|
||||
Assert.Equal(new int[] { 1, 2, 3 }, values);
|
||||
Assert.Equal(new[] { 1, 2, 3 }, values);
|
||||
}
|
||||
|
||||
// kill the connections
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
|
||||
public Task SendArray()
|
||||
{
|
||||
return Clients.All.SendAsync("Array", new int[] { 1, 2, 3 });
|
||||
return Clients.All.SendAsync("Array", new[] { 1, 2, 3 });
|
||||
}
|
||||
|
||||
public Task<int> TaskValueMethod()
|
||||
|
|
|
|||
Loading…
Reference in New Issue