diff --git a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs index 11b2633..7da8ea8 100644 --- a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs +++ b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using System.Text; using TypedSignalR.Client.CodeAnalysis; @@ -24,6 +23,7 @@ public string TransformText() // #nullable enable #pragma warning disable CS1591 +#pragma warning disable CS8767 namespace TypedSignalR.Client { internal static partial class HubConnectionExtensions @@ -67,6 +67,7 @@ private sealed class BinderFor_{{receiverType.CollisionFreeName}} : IReceiverBin } } } +#pragma warning restore CS8767 #pragma warning restore CS1591 """); diff --git a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs index cc33ab0..a301d5c 100644 --- a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs +++ b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs @@ -26,6 +26,7 @@ public string TransformText() // #nullable enable #pragma warning disable CS1591 +#pragma warning disable CS8767 namespace TypedSignalR.Client { internal static partial class HubConnectionExtensions @@ -80,6 +81,7 @@ private sealed class HubInvokerFactoryFor_{{hubType.CollisionFreeName}} : IHubIn } } } +#pragma warning restore CS8767 #pragma warning restore CS1591 """); diff --git a/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs b/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs index 6753be0..22307c1 100644 --- a/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs +++ b/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs @@ -46,7 +46,7 @@ public static string CreateArgumentsString(this MethodMetadata methodMetadata) var sb = new StringBuilder(); - sb.Append("new object[] { "); + sb.Append("new object?[] { "); sb.Append(methodMetadata.Parameters[0].Name); for (int i = 1; i < methodMetadata.Parameters.Count; i++) @@ -63,7 +63,8 @@ public static string CreateArgumentsString(this MethodMetadata methodMetadata) public static string CreateArgumentsStringExceptCancellationToken(this MethodMetadata methodMetadata, SpecialSymbols specialSymbols) { var parameters = methodMetadata.Parameters - .Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol)).ToArray(); + .Where(x => !SymbolEqualityComparer.Default.Equals(x.Type, specialSymbols.CancellationTokenSymbol)) + .ToArray(); if (parameters.Length == 0) { @@ -72,7 +73,7 @@ public static string CreateArgumentsStringExceptCancellationToken(this MethodMet var sb = new StringBuilder(); - sb.Append("new object[] { "); + sb.Append("new object?[] { "); sb.Append(parameters[0].Name); for (int i = 1; i < parameters.Length; i++) @@ -183,8 +184,8 @@ public static string CreateMethodString(this MethodMetadata methodMetadata, Spec HubMethodType.ServerStreamingAsAsyncEnumerable => CreateServerStreamingMethodAsAsyncEnumerableString(methodMetadata, specialSymbols), HubMethodType.ServerStreamingAsTaskAsyncEnumerable => CreateServerStreamingMethodAsTaskAsyncEnumerableString(methodMetadata, specialSymbols), HubMethodType.ServerStreamingAsChannel => CreateServerStreamingMethodAsChannelString(methodMetadata, specialSymbols), - HubMethodType.ClientStreamingAsAsyncEnumerable => CreateClientStreamingMethodAsAsyncEnumerableString(methodMetadata, specialSymbols), - HubMethodType.ClientStreamingAsChannel => CreateClientStreamingMethodAsChannelString(methodMetadata, specialSymbols), + HubMethodType.ClientStreamingAsAsyncEnumerable => CreateClientStreamingMethodAsAsyncEnumerableString(methodMetadata), + HubMethodType.ClientStreamingAsChannel => CreateClientStreamingMethodAsChannelString(methodMetadata), _ => string.Empty }; } @@ -294,7 +295,7 @@ private static string CreateServerStreamingMethodAsChannelString(MethodMetadata """; } - private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodMetadata method, SpecialSymbols specialSymbols) + private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodMetadata method) { return $$""" public {{method.ReturnType}} {{method.MethodName}}({{method.CreateParametersString()}}) @@ -304,7 +305,7 @@ private static string CreateClientStreamingMethodAsAsyncEnumerableString(MethodM """; } - private static string CreateClientStreamingMethodAsChannelString(MethodMetadata method, SpecialSymbols specialSymbols) + private static string CreateClientStreamingMethodAsChannelString(MethodMetadata method) { return $$"""