BoDi icon indicating copy to clipboard operation
BoDi copied to clipboard

Add IAsyncDispose support

Open idg10 opened this issue 2 years ago • 2 comments

Although #49 was closed on the grounds that SpecFlow "won't probably use it for a long time", @SabotageAndi did say:

But that doesn't mean, that we would not accept a PR for it

So here's a PR for it.

This necessarily expands the set of target frameworks. Previously, the target frameworks were net45 and netcoreapp2.0, we need to add netcoreapp3.1 because each of these has a different relationship with IAsyncDisposable

  • net45: no support available
  • netstandard2.0: implemented via Microsoft.Bcl.AsyncInterfaces NuGet package
  • netcoreapp3.1: built into .NET runtime class libraries

If we continued to target only netstandard2.0, we'd be introducing an unnecessary dependency on Microsoft.Bcl.AsyncInterfaces for any apps using .NET Core 3.1 or later. so although .NET Core 3.1 does of course support netstandard2.0, it's better to provide a .NET Core 3.1 target that doesn't need the extra reference to get IAsyncDisposable.

idg10 avatar Mar 18 '22 16:03 idg10

I've opened this in draft mode because I don't yet know whether you would like https://github.com/SpecFlowOSS/SpecFlow/issues/2575 to be implemented. That's the only reason I'm looking to add this.

If you do want that, I want to prototype the SpecFlow side of the implementation to the point that it can validate that the BoDi changes in this PR are sufficient. I was aiming to set this to "ready for review" once I've done that validation.

idg10 avatar Mar 18 '22 16:03 idg10

The comment was from a time when https://github.com/SpecFlowOSS/SpecFlow/pull/1614 was way in the future. As I commented today there, with the retirement of the SpecFlow+ Runner, the biggest blocker for it is gone.

So I think, when async/await is fixed in SpecFlow, this PR is useful. I don't know if it is already making sense to bring this to SpecFlow, as for me the async/await support in SpecFlow is simply not finished.

SabotageAndi avatar Mar 21 '22 14:03 SabotageAndi