Skip to content

Why doesn’t SessionDataSet implement the IAsyncDisposable interface? #54

@HXCK3D

Description

@HXCK3D

Currently, SessionDataSet implements the IDisposable interface. However, in its Dispose() method, the asynchronous Close() method is invoked synchronously.

Actual implementation:

protected virtual void Dispose(bool disposing)
{
  if (this.disposedValue)
    return;
  if (disposing)
  {
    try
    {
      //synchronous call
      this.Close().Wait();
    }
    catch
    {
    }
  }
  this.disposedValue = true;
}

Proposed implementation:

protected virtual Task DisposeAsync(bool disposing)
{
  if (this.disposedValue)
    return;
  if (disposing)
  {
    try
    {
      //asynchronous call
      await this.Close();
    }
    catch
    {
    }
  }
  this.disposedValue = true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions