Allow null arguments from HubConnection (#11241)
This commit is contained in:
parent
f652c22202
commit
5872814a64
|
|
@ -627,7 +627,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (ReflectionHelper.IsStreamingType(args[i].GetType()))
|
||||
if (args[i] != null && ReflectionHelper.IsStreamingType(args[i].GetType()))
|
||||
{
|
||||
if (readers == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,6 +138,34 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(HubProtocolsList))]
|
||||
public async Task CanSendNull(string protocolName)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartServer<Startup>(out var server))
|
||||
{
|
||||
var connection = CreateHubConnection(server.Url, "/default", HttpTransportType.LongPolling, protocol, LoggerFactory);
|
||||
try
|
||||
{
|
||||
await connection.StartAsync().OrTimeout();
|
||||
|
||||
var result = await connection.InvokeAsync<string>(nameof(TestHub.Echo), null).OrTimeout();
|
||||
|
||||
Assert.Null(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerFactory.CreateLogger<HubConnectionTests>().LogError(ex, "{ExceptionType} from test", ex.GetType().FullName);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
await connection.DisposeAsync().OrTimeout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(HubProtocolsAndTransportsAndHubPaths))]
|
||||
[LogLevel(LogLevel.Trace)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue