Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,13 @@ public static string GetAccessibilityString(Accessibility accessibility)
return null;
}
}

public static string SourceFilePrefix()
{
return @"// <auto-generated>
// Generated by Microsoft.AspNetCore.Client.SourceGenerator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding the assembly file version to the header? e.g.

Generated by Microsoft.AspNetCore.Client.SourceGenerator 7.0.22.35609

Makes it easier to see at a glance what version of the generator ran.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what comes from the AssemblyInfo generator:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good addition once we start shipping this package.

// </auto-generated>
#nullable enable
";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,15 @@ private void EmitExtensions()
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}));
}}");
}

// Generate RegisterCallbackProvider<T> extension method and CallbackProviderRegistration class
// 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}
Expand Down Expand Up @@ -133,12 +128,7 @@ private void EmitRegistrationMethod(TypeSpec typeSpec)
// 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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ private void EmitExtensions()
}}");
}

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}
Expand Down Expand Up @@ -146,12 +141,7 @@ private void EmitProxy(ClassSpec classSpec)
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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<Nullable>enable</Nullable>
<IsShipping>false</IsShipping>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down