Просмотр исходного кода

Mark SignalR SourceGen as not shipping for RC and RTM (#42720)

Brennan 3 лет назад
Родитель
Сommit
6b7781dfb5

+ 9 - 0
src/SignalR/clients/csharp/Client.SourceGenerator/src/GeneratorHelpers.cs

@@ -25,4 +25,13 @@ internal static class GeneratorHelpers
                 return null;
         }
     }
+
+    public static string SourceFilePrefix()
+    {
+        return @"// <auto-generated>
+// Generated by Microsoft.AspNetCore.Client.SourceGenerator
+// </auto-generated>
+#nullable enable
+";
+    }
 }

+ 3 - 13
src/SignalR/clients/csharp/Client.SourceGenerator/src/HubClientProxyGenerator.Emitter.cs

@@ -53,7 +53,7 @@ internal partial class HubClientProxyGenerator
                 registerProviderBody.AppendLine($@"
             if (typeof({_spec.SetterTypeParameterName}) == typeof({fqtn}))
             {{
-                return (System.IDisposable) new CallbackProviderRegistration({methodName}({_spec.SetterHubConnectionParameterName}, ({fqtn}) provider));
+                return (System.IDisposable) new CallbackProviderRegistration({methodName}({_spec.SetterHubConnectionParameterName}, ({fqtn}) {_spec.SetterProviderParameterName}));
             }}");
             }
 
@@ -61,12 +61,7 @@ internal partial class HubClientProxyGenerator
             // RegisterCallbackProvider<T> is used by end-user to register their callback provider types
             // CallbackProviderRegistration is a private implementation of IDisposable which simply holds
             //  an array of IDisposables acquired from registration of each callback method from HubConnection
-            var extensions = $@"// <auto-generated>
-// Generated by Microsoft.AspNetCore.Client.SourceGenerator
-// </auto-generated>
-
-#nullable enable
-
+            var extensions = GeneratorHelpers.SourceFilePrefix() + $@"
 using Microsoft.AspNetCore.SignalR.Client;
 
 namespace {_spec.SetterNamespace}
@@ -133,12 +128,7 @@ namespace {_spec.SetterNamespace}
             // The actual registration method goes thru each method that the callback provider type has and then
             //  registers the method with HubConnection and stashes the returned IDisposable into an array for
             //  later consumption by CallbackProviderRegistration's constructor
-            var registrationMethodBody = new StringBuilder($@"// <auto-generated>
-// Generated by Microsoft.AspNetCore.Client.SourceGenerator
-// </auto-generated>
-
-#nullable enable
-
+            var registrationMethodBody = new StringBuilder(GeneratorHelpers.SourceFilePrefix() + $@"
 using Microsoft.AspNetCore.SignalR.Client;
 
 namespace {_spec.SetterNamespace}

+ 2 - 12
src/SignalR/clients/csharp/Client.SourceGenerator/src/HubServerProxyGenerator.Emitter.cs

@@ -57,12 +57,7 @@ internal partial class HubServerProxyGenerator
             }}");
             }
 
-            var getProxy = $@"// <auto-generated>
-// Generated by Microsoft.AspNetCore.Client.SourceGenerator
-// </auto-generated>
-
-#nullable enable
-
+            var getProxy = GeneratorHelpers.SourceFilePrefix() + $@"
 using Microsoft.AspNetCore.SignalR.Client;
 
 namespace {_spec.GetterNamespace}
@@ -146,12 +141,7 @@ namespace {_spec.GetterNamespace}
                 methods.Append(method);
             }
 
-            var proxy = $@"// <auto-generated>
-// Generated by Microsoft.AspNetCore.Client.SourceGenerator
-// </auto-generated>
-
-#nullable enable
-
+            var proxy = GeneratorHelpers.SourceFilePrefix() + $@"
 using Microsoft.AspNetCore.SignalR.Client;
 
 namespace {_spec.GetterNamespace}

+ 1 - 1
src/SignalR/clients/csharp/Client.SourceGenerator/src/Microsoft.AspNetCore.SignalR.Client.SourceGenerator.csproj

@@ -4,7 +4,7 @@
     <TargetFramework>netstandard2.0</TargetFramework>
     <IncludeBuildOutput>false</IncludeBuildOutput>
     <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
-    <Nullable>enable</Nullable>
+    <IsShipping>false</IsShipping>
   </PropertyGroup>
 
   <ItemGroup>

+ 1 - 1
src/SignalR/clients/csharp/Client/test/UnitTests/HubClientProxyGeneratorTests.cs

@@ -18,7 +18,7 @@ internal class HubClientProxyAttribute : Attribute
 internal static partial class RegisterCallbackProviderExtensions
 {
     [HubClientProxy]
-    public static partial IDisposable SetHubClient<T>(this HubConnection conn, T provider);
+    public static partial IDisposable SetHubClient<T>(this HubConnection conn, T p);
 }
 
 public class HubClientProxyGeneratorTests