Skip to content

Commit

Permalink
Nullability in SignalR (#29219)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennanConroy committed Feb 17, 2021
1 parent 9137d90 commit 46359cd
Show file tree
Hide file tree
Showing 102 changed files with 1,436 additions and 949 deletions.
3 changes: 2 additions & 1 deletion eng/targets/CSharp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
SuppressNullableAttributesImport to disable. Used when attributes are already present from another project because of InternalsVisibleTo.
-->
<When Condition="'$(Nullable)' != '' AND '$(SuppressNullableAttributesImport)' != 'true' AND ('$(TargetFrameworkIdentifier)' == '.NETStandard' OR '$(TargetFrameworkIdentifier)' == '.NETFramework')">
<When Condition="'$(Nullable)' != '' AND '$(SuppressNullableAttributesImport)' != 'true' AND
(('$(TargetFrameworkIdentifier)' == '.NETStandard' AND $([MSBuild]::VersionLessThanOrEquals('$(TargetFrameworkVersion)', '2.0'))) OR '$(TargetFrameworkIdentifier)' == '.NETFramework')">
<PropertyGroup>
<DefineConstants>$(DefineConstants),INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>
<NoWarn>$(NoWarn);nullable</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Ignitor/src/BlazorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ private void OnError(string error)
NextErrorReceived?.Completion?.TrySetResult(null);
}

private Task OnClosedAsync(Exception ex)
private Task OnClosedAsync(Exception? ex)
{
NextDisconnect?.Completion?.TrySetResult(null);

Expand Down
152 changes: 76 additions & 76 deletions src/SignalR/clients/csharp/Client.Core/src/HubConnection.Log.cs

Large diffs are not rendered by default.

164 changes: 82 additions & 82 deletions src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public HubConnection Build()
var endPoint = serviceProvider.GetService<EndPoint>() ??
throw new InvalidOperationException($"Cannot create {nameof(HubConnection)} instance. An {nameof(EndPoint)} was not configured.");

return serviceProvider.GetService<HubConnection>();
return serviceProvider.GetRequiredService<HubConnection>();
}

// Prevents from being displayed in intellisense
Expand All @@ -66,15 +66,15 @@ public override int GetHashCode()
// Prevents from being displayed in intellisense
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return base.Equals(obj);
}

// Prevents from being displayed in intellisense
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString()
public override string? ToString()
{
return base.ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class HubConnectionExtensions
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, Array.Empty<object>(), cancellationToken);
return hubConnection.InvokeCoreAsync(methodName, Array.Empty<object?>(), cancellationToken);
}

/// <summary>
Expand All @@ -35,7 +35,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, CancellationToken cancellationToken = default)
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, new[] { arg1 }, cancellationToken);
}
Expand All @@ -50,7 +50,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, CancellationToken cancellationToken = default)
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, new[] { arg1, arg2 }, cancellationToken);
}
Expand All @@ -66,7 +66,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default)
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3 }, cancellationToken);
}
Expand All @@ -83,7 +83,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken);
}
Expand All @@ -101,7 +101,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default)
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, CancellationToken cancellationToken = default)
{
return hubConnection.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken);
}
Expand All @@ -120,7 +120,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
public static Task InvokeAsync(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default)
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.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken);
}
Expand All @@ -140,7 +140,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
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)
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.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken);
}
Expand All @@ -161,7 +161,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
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)
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.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken);
}
Expand All @@ -183,7 +183,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
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)
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.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken);
}
Expand All @@ -206,7 +206,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple overloads with optional parameters", Justification = "Required to maintain compatibility")]
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)
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.InvokeCoreAsync(methodName, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken);
}
Expand All @@ -219,7 +219,7 @@ public static Task InvokeAsync(this HubConnection hubConnection, string methodNa
/// <param name="args">The arguments used to invoke the server method.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous invoke.</returns>
public static Task InvokeCoreAsync(this HubConnection hubConnection, string methodName, object[] args, CancellationToken cancellationToken = default)
public static Task InvokeCoreAsync(this HubConnection hubConnection, string methodName, object?[] args, CancellationToken cancellationToken = default)
{
if (hubConnection == null)
{
Expand Down
Loading

0 comments on commit 46359cd

Please sign in to comment.