Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let Container and Scope classes implement IAsyncDisposable #791

Closed
dotnetjunkie opened this issue Dec 29, 2019 · 2 comments
Closed

Let Container and Scope classes implement IAsyncDisposable #791

dotnetjunkie opened this issue Dec 29, 2019 · 2 comments

Comments

@dotnetjunkie
Copy link
Collaborator

@dotnetjunkie dotnetjunkie commented Dec 29, 2019

Feature #778 adds async disposable support for ASP.NET Core, but even outside the realm of ASP.NET Core, async disposable support is useful in two places:

  • To asynchronously dispose of disposables on a Scope
  • To asynchronously dispose the Container.

Because of the extra required Microsoft.Bcl.AsyncInterfaces package, I feel adding support to the core library is unsuited for v4, but we might want to reconsider for v5.

@dotnetjunkie dotnetjunkie added this to the v5.0 milestone Dec 29, 2019
@dotnetjunkie
Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented Apr 30, 2020

feature-791 branch created.

dotnetjunkie added a commit that referenced this issue Apr 30, 2020
…n package. Now any component implementing IAsyncDisposable will be disposed, not only those that also implement IDisposable. #791.
dotnetjunkie added a commit that referenced this issue May 4, 2020
…ill also call all IDisposable.Dispose methods and calling Scope.Dispose will be a no-op after calling Scope.DisposeAsync. Also changed the locking behavior of Scope. Disposing is now not thread safe any longer. This didn't make much sense, as no one in their right mind would dispose from multiple threads. #791.
dotnetjunkie added a commit that referenced this issue May 4, 2020
…nc, and ensured the stack trace is stored after calling DisposeAsync. #791.
dotnetjunkie added a commit that referenced this issue May 4, 2020
@dotnetjunkie
Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented May 4, 2020

The Microsoft.Bcl.AsyncInterfaces library requires >= .NET 4.6.1 or >= .NET Standard 2.0. The IAsyncDisposable interface is included in .NET Standard 2.1. Because of this constraint, 2 new build outputs will be added for the Simple Injector core library, namely:

  • .NET 4.6.1
  • .NET Standard 2.1

This means that the following following Simple Injector builds will not support IAsyncDisposable:

  • .NET Standard 1.0
  • .NET Standard 1.3
  • .NET 4.5

@dotnetjunkie dotnetjunkie changed the title Add IAsyncDisposable integration into Core library using Scope.AsyncDispose and Container.AsyncDispose Let Container and Scope classes implement IAsyncDisposable Jun 6, 2020
dotnetjunkie added a commit that referenced this issue Jun 10, 2020
…nterface names instead of the simplified name. #791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant