Closed RobertBieligIBA closed 5 years ago
I have the same problem and to fix this issue, you can change RegisterService.cs,
add variable to the class :
private CancellationTokenSource cts = null;
On registerAsync, add cts.Token :
this.task = Task.Run (() => this.ProcessRegister ()).ContinueWith (_ => this.task = null,cts.Token) ;
On Dispose, call
if (cts != null) cts.Cancel();
instead of ;
this.task?.Wait () ;
Included in 1.2 release.
I was trying to register and then deregister a service, but on de-register the method Dispose hangs and never comes back. Is there a solution for it?
Analysis: Problem is, that this.sdRef.Process (); in method ProcessRegister() is blocking, therefore the this.task will never finish. In Dispose this.task?.Wait (); is called which will block the application.