SignalR Stream is will throw when combined with ToObservable from IX.net, and the stream completes.
See original GitHub issuepublic class FooHub : Hub
{
public IAsyncEnumerable<int> Foo()
{
return AsyncEnumerable.Empty<int>();
}
}
public static class Program
{
public async Task Main()
{
await new HubConnectionBuilder()
.WithUrl(....)
.Build()
.StreamAsync(nameof(FooHub.Foo))
.ToObservable()
.Do(x => Console.WriteLine(x))
.ToTask();
}
}
This will throw an exception of CancellationTokenSource ObjectDisposedException.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Use streaming in ASP.NET Core SignalR
To end the stream from the client, call the dispose method on the ISubscription that's returned from the subscribe method. Calling this method ......
Read more >How to correctly dispose a client stream if the connection ...
I'm using Microsoft.AspNetCore.SignalR 2.1 v1.0.4 and have a ChannelReader stream being consumed by a typescript client using v1.0.4. The ...
Read more >Intro to SignalR in C# Part 1 - using Blazor, WPF ... - YouTube
SignalR is an excellent way to connect two or more clients together for real-time communication. The best part is that this library is...
Read more >Quick Introduction to SignalR Streaming - YouTube
Streaming is a brand new feature in SignalR that isn't commonly talked about. It can help you more efficiently send data from your...
Read more >Streaming in SignalR - Scientific Programmer
SignalR can stream from the client to the server and from the server to the client. We will have a look at both,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Minimal repro without IX.net
The issue is that we dispose an internal cts when the server sends a stream completion https://github.com/dotnet/aspnetcore/blob/b4f8e0f587c064b67b99e7ee5f1562fc61ba9242/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs#L579
Then, if the user cancels a token passed into
GetAsyncEnumerator
before the enumerator is disposed we will try to cancel the disposed cts from earlier https://github.com/dotnet/aspnetcore/blob/b4f8e0f587c064b67b99e7ee5f1562fc61ba9242/src/SignalR/common/Shared/AsyncEnumerableAdapters.cs#L69Thanks for contacting us. We’re moving this issue to the
Next sprint planning
milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.