-
Notifications
You must be signed in to change notification settings - Fork 69
Description
I've called AddRemoteAppClient like so:
services.AddSystemWebAdapters()
.AddRemoteAppClient(options =>
{
options.BackchannelHandler = new MyBackChannelHandler();
}
Where BackChannelHandler is basically just a HttpClientHandler with some logging. But a few times during testing I've got an ObjectDisposedException: cannot access a disposed object. object name: 'SocketsHttpHandler'. in my HttpClientHandler's SendAsync:
(sorry for the screenshot, didn't grab the plain text)
On investigation It would appear that HttpClientHandler should be a new instance every time, otherwise you eventually hit this ObjectDisposedException. See dotnet/runtime#27610 for another example.
Therefore I suggest that RemoteAppClientOptions.BackchannelHandler be changed so that it's something like a Func<HttpMessageHandler> instead, so that AddRemoteAppClient can call it to get a new instance each time.
For example:
Line 38 in 9921217
| if (options.BackchannelHandler is { } handler) |
Change:
if (options.BackchannelHandler is { } handler)
{
return handler;
}
To something like:
if (options.BackchannelHandlerFactory is { } factory)
{
return factory();
}
