Skip to content

Disposing transports can hang when running in .NET framework #255

Description

@eiriktsarpalis

This is because the read loop in the core transport abstraction uses TextWriter:

if(await_serverOutput.ReadLineAsync(cancellationToken).ConfigureAwait(false)is not stringline)

varline=await_inputReader.ReadLineAsync(shutdownToken).ConfigureAwait(false);

Which in netstandard2.0 is not cancellable and requires a polyfill that does not properly honor the cancellation token:

publicstaticTask<string>ReadLineAsync(thisTextReaderreader,CancellationTokencancellationToken)
{
if(cancellationToken.IsCancellationRequested)
{
returnTask.FromCanceled<string>(cancellationToken);
}
returnreader.ReadLineAsync();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions