aspnetcore: SignalR: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Http.HttpClientHandler' when calling "await Connection.StartAsync();"
Describe the bug
When I try to connect to SignalR server in Xamarin App (UWP), where SignalR server is not available, I get the expected exception that server is not available:
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Runtime.InteropServices.COMException: Der Text zu diesem Fehlercode wurde nicht gefunden.
Die Serververbindung konnte nicht hergestellt werden.
This is fine, but when I now start the AspNet Core SignalR server and try to connect again to SignalR service (without restarting the app) I get this unexpected exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Http.HttpClientHandler'.
To Reproduce
Steps to reproduce the behavior:
- Using this version of ASP.NET Core ‘…’ https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/1.1.0
- Run this code ‘…’

Expected behavior
Attempt to connect to SignalR should now find the started Server and connection should be started correctly.
Screenshots

Additional context
- VS2017 15.9.6
- Xamarin.Forms 3.4 Solution with UWP (MinVersion 16299, Target: 17763)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (9 by maintainers)
@anurse
ok, currently I use my dummy HubConnectionBuilder workaround and everything is good, no error.
OK I’m going to put this issue in preview4 (since preview3 is winding down at the moment). If you could point us to that simple repro that would be great. We can figure out where the issue goes.