Add debug info

This commit is contained in:
Malte Rosenbjerg 2020-12-06 00:34:27 +01:00
parent 9c3d8d4338
commit fd723e06a9

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.IO.Pipes; using System.IO.Pipes;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -30,6 +31,7 @@ public void Pre()
public void Post() public void Post()
{ {
Debug.WriteLine($"Disposing NamedPipeServerStream on {GetType().Name}");
Pipe?.Dispose(); Pipe?.Dispose();
Pipe = null!; Pipe = null!;
} }
@ -39,9 +41,11 @@ public async Task During(CancellationToken cancellationToken = default)
try try
{ {
await ProcessDataAsync(cancellationToken); await ProcessDataAsync(cancellationToken);
Debug.WriteLine($"Disconnecting NamedPipeServerStream on {GetType().Name}");
} }
catch (TaskCanceledException) catch (TaskCanceledException)
{ {
Debug.WriteLine($"ProcessDataAsync on {GetType().Name} cancelled");
} }
Pipe.Disconnect(); Pipe.Disconnect();
} }