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

Support IAsyncDisposable in bindings #2575

Open
idg10 opened this issue Mar 18, 2022 · 1 comment
Open

Support IAsyncDisposable in bindings #2575

idg10 opened this issue Mar 18, 2022 · 1 comment

Comments

@idg10
Copy link
Contributor

idg10 commented Mar 18, 2022

Link to Feature Request

https://support.specflow.org/hc/en-us/community/posts/4410211637521-Support-IAsyncDisposable-in-bindings

Implementation Idea

Support for this needs to be implemented in BoDi, because that's what performs the actual disposal. To enable this, I've created SpecFlowOSS/BoDi#51

If that PR gets accepted into BoDi, the minimal implementation of this feature in SpecFlow would just be to upgrade to the version of BoDi that supports IAsyncDisposable.

However, it would be better to do slightly more than that, because in that minimal case, SpecFlow projects would continue to dispose containers using non-async IDisposable.Dispose. And although SpecFlowOSS/BoDi#51 does support disposing IAsyncDisposable objects even when the container is disposed synchronously, this inevitably lead to "sync over async", which is best avoided.

So it would be better to modify SpecFlow so that when it disposes the BoDi container, it does so with IAsyncDisposable.DisposeAsync, returning a Task up to whichever test framework is in use. That way it's async all the way up, and we avoid any risk of sync over async.

But it would be good to get a steer on whether you're actually interested in taking such a PR before I do the work!

@SabotageAndi
Copy link
Contributor

Answered in the BoDi PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants