SignalR.Strong icon indicating copy to clipboard operation
SignalR.Strong copied to clipboard

hasChannelReaderArgument always throws

Open danzel opened this issue 4 years ago • 3 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!

danzel avatar Jun 24 '21 20:06 danzel

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.

mehmetakbulut avatar Jul 29 '21 04:07 mehmetakbulut

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

mehmetakbulut avatar Jul 29 '21 05:07 mehmetakbulut

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

danzel avatar Jul 29 '21 21:07 danzel