mehmetakbulut / SignalR.Strong

Strongly-typed calls from client to server and handlers for calls from server to client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hasChannelReaderArgument always throws

danzel opened this issue · comments

When using SignalR.Strong.Dynamic for our client and calling a hub method:
public Task TakeAString(string myString);

We get a System.InvalidOperationException with the message This operation is only valid on generic types.
Which stack traces back to here:
https://github.com/mehmetakbulut/SignalR.Strong/blob/master/SignalR.Strong.Dynamic/HubInterceptor.cs#L53

From the docs it looks like we should check IsGenericType before calling GetGenericTypeDefinition.
https://docs.microsoft.com/en-us/dotnet/api/system.type.getgenerictypedefinition?view=net-5.0

Switching to SignalR.Strong.SourceGenerator works.
Can PR this if you'd like, thanks for the project!

Hi Danzel! I have been working on getting the source generator contributed to ASP.NET Core so hopefully these capabilities will be available out-of-box at some point.

If you have the time to put together the PR, I'd be happy to review and create a new release for .Dynamic.

If you are already happy with source-generator over dynamic, I'd recommend staying with the source-generator though.

Will stick with source generator now that it is fixed.
Thank you for this project 👍