-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When my client was disconnected it throws exception
My usage:
private readonly IPipeClient<PipeMessage> _client;
private async void ClientOnDisconnected(object? _, ConnectionEventArgs<PipeMessage> e)
{
_logger.LogInformation("IPC client name {name} was disconnected", e.Connection.PipeName);
while (!_client.IsConnected)
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3));
try
{
await Start(cancellationTokenSource.Token).ConfigureAwait(false);
}
catch (Exception exception)
{
_logger.LogWarning(exception,"Failed to reconnect");
}
}
}
public async Task Start(CancellationToken cancellationToken = default)
{
_logger.LogInformation("Connecting to IPC {pipeName}", _client.PipeName);
await _client.ConnectAsync(cancellationToken);
}
Steps to reproduce the bug
Just stop IPC server
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Timers.Timer'.
at void System.Timers.Timer.set_Enabled(bool value)
at async Task H.Pipes.PipeClient.ConnectAsync(CancellationToken cancellationToken) in //src/libs/H.Pipes/PipeClient.cs:line 173
at async Task Ipc.Client.BaseIpcClient.Start(CancellationToken cancellationToken) in //src/Ipc/Client/BaseIpcClient.cs:line 141
at async void Ipc.Client.BaseIpcClient.ClientOnDisconnected(object , ConnectionEventArgs e) in //src/Ipc/Client/BaseIpcClient.cs:line 26
Expected behavior
No response
Screenshots
No response
NuGet package version
2.0.59
Platform
Console
IDE
Visual Studio 2022
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working