Skip to content

Support IAsyncEnumerable<T> and ChannelReader<T> with ValueTypes in SignalR native AOT #56583

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

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Jul 2, 2024

Support streaming ValueTypes from a SignalR Hub method in both the client and the server in native AOT. In order to make this work, we need to use pure reflection to read from the streaming object.

Support passing in an IAsyncEnumerable/ChannelReader of ValueType to a parameter in SignalR.Client. This works because the user code creates the concrete object, and the SignalR.Client library just needs to read from it using reflection.

The only scenario that can't be supported is on the SignalR server we can't support receiving an IAsyncEnumerable/ChannelReader of ValueType. This is because there is no way for the SignalR library code to construct a concrete instance to pass into the user-defined method on native AOT.

Fix #56179

…ignalR native AOT

Support streaming ValueTypes from a SignalR Hub method in both the client and the server in native AOT. In order to make this work, we need to use pure reflection to read from the streaming object.

Support passing in an IAsyncEnumerable/ChannelReader of ValueType to a parameter in SignalR.Client. This works because the user code creates the concrete object, and the SignalR.Client library just needs to read from it using reflection.

The only scenario that can't be supported is on the SignalR server we can't support receiving an IAsyncEnumerable/ChannelReader of ValueType. This is because there is no way for the SignalR library code to construct a concrete instance to pass into the user-defined method on native AOT.

Fix dotnet#56179
@ghost ghost added the area-signalr Includes: SignalR clients and servers label Jul 2, 2024
@eerhardt eerhardt merged commit afc520c into dotnet:main Jul 8, 2024
26 checks passed
@eerhardt eerhardt deleted the SignalRNativeAOT-SupportStreamingValueTypes branch July 8, 2024 20:00
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview7 milestone Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SignalR: Using IAsyncEnumerable<T> and ChannelReader<T> with ValueTypes in native AOT
3 participants