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

Update DI and Hosting to use Microsoft.Bcl.AsyncInterfaces #2137

Merged
merged 6 commits into from
Sep 5, 2019
Merged

Update DI and Hosting to use Microsoft.Bcl.AsyncInterfaces #2137

merged 6 commits into from
Sep 5, 2019

Conversation

kevinchalet
Copy link

Fixes #1467.

/cc @Tratcher @anurse (I believe you own the Hosting stack)
/cc @davidfowl @Eilon (not sure who's responsible of DI these days 😄)

@kevinchalet kevinchalet marked this pull request as ready for review August 5, 2019 14:24
Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good. @davidfowl @anurse who would know what the plans are for Microsoft.Bcl.AsyncInterfaces to see if it meets our requirements?

@davidfowl
Copy link
Member

This is a good change but we don’t want any unnecessary package refs by default on netcoreapp3.0 which means we’ll need to multi target in more places (like hosting). @JunTaoLuo was working on that.

@kevinchalet
Copy link
Author

kevinchalet commented Aug 6, 2019

@davidfowl both the hosting abstractions and implementations packages already target netstandard20 and netcoreapp30, with the BCL async package excluded for netcoreapp30.

AFAICT, most of the packages here reference Microsoft.Extensions.DependencyInjection.Abstractions, which doesn't need the BCL package (only Microsoft.Extensions.DependencyInjection does).

The only stack that uses Microsoft.Extensions.DependencyInjection is logging (both Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Testing reference Microsoft.Extensions.DependencyInjection). These 2 packages could be easily updated to include a netstandard21 TFM.

Would you like me to do that?

@Tratcher
Copy link
Member

Tratcher commented Aug 6, 2019

@kevinchalet
Copy link
Author

Perfect, I'll leave this PR as-is, then. Let me know if there's anything I help with.

@analogrelay
Copy link

@Tratcher @davidfowl to be clear, this hasn't yet been submitted for 3.0 approval. Please make sure to check in with me before merging anything. I do have concerns about the churn this will create in 3.0 and the very short runway we have to make sure we get this right.

@kevinchalet
Copy link
Author

kevinchalet commented Aug 6, 2019

@anurse it's your call, but I'd be interested in reading more about your concerns.

To be clear, this PR doesn't add new code, it simply realigns the .NET Standard source with the .NET Core one by using the BCL async package and removing conditional compilation constants that previously excluded async disposal support from .NET Standard. It's exactly what you guys did in ASP.NET Core with the connections abstractions and the SignalR .NET client (which is why I assumed it was an oversight).

It's also worth mentioning this area was already covered by many tests, that will now ensure async disposal works just fine on .NET Framework.

@analogrelay
Copy link

@anurse it's your call

It's not actually my call, but it is indeed our call ;).

It's exactly what you guys did in ASP.NET Core with the connections abstractions and the SignalR .NET client (which is why I assumed it was an oversight).

We implemented IAsyncDisposable there but it's not quite the same as these changes which are actively using those interfaces in DI.

In general, I agree that this change makes sense and was probably just an oversight. We just need to work through the risk. For example, an issue just arose from this discussion (though it's not directly relevant to this PR and exists in the netcoreapp3.0 version): dotnet/aspnetcore#12918

@kevinchalet
Copy link
Author

Roger.

For example, an issue just arose from this discussion (though it's not directly relevant to this PR and exists in the netcoreapp3.0 version): dotnet/aspnetcore#12918

Nice. Glad it helped find a bug there 😄

@davidfowl
Copy link
Member

See #2090. This is in the same bucket and is less risky than the linked PR

@kevinchalet
Copy link
Author

Looks like there are merge conflicts. Do you want me to rebase this PR?

@kevinchalet
Copy link
Author

@davidfowl @anurse did you guys eventually come to an agreement? 😄

@Pilchie
Copy link
Member

Pilchie commented Aug 21, 2019

@PinpointTownes they both happen to be out right now, but I'll get back to you by Monday at the latest. Sorry for the delay.

@kevinchalet
Copy link
Author

Thanks @Pilchie!

No hurry, I just wanted to make sure this was still considered for the final 3.0 release, since it enables an important scenario (i.e async disposables on .NET Standard 2.0-only platforms like .NET Framework).

@JunTaoLuo
Copy link

@Pilchie are we still planning on getting this into 3.0?

cc @aspnet/build for awareness.

@kevinchalet
Copy link
Author

@JunTaoLuo in the same vein: dotnet/aspnetcore#13343 (I'm pretty sure the Extensions repo also has problematic calls)

@davidfowl
Copy link
Member

Yes we should look at getting this for 3.0.

@kevinchalet
Copy link
Author

Rebased and resolved the conflicts in the props files 😄

@kevinchalet
Copy link
Author

Hum, the CI failure looks like a flaky test 🤕

@JunTaoLuo
Copy link

I'm taking a closer look at the downstream effects and I see a few more packages that are affected:

I see quite a few instances where these affected packages target netstandard2.1 so I'm thinking that if we cross-target M.E.Hosting and M.E.DependencyInjection with netstandard2.1 we should resolve most of these issues without requiring additional changes in downstream packages.

Thoughts @davidfowl ?

@JunTaoLuo
Copy link

@PinpointTownes Can you make the changes I mentioned in the previous comment? We need to additionally cross-target netstandard2.1 for M.E.Hosting, M.E.DependencyInjection and M.E.Hosting.WindowsServices. The last one is needed to ensure the dependency isn't referenced in an app that references it running on core.

@kevinchalet
Copy link
Author

@JunTaoLuo I'm OOO today but feel free to directly push that to my fork so it's added to this PR.

Otherwise, I'll take a look tonight 😄

@Pilchie
Copy link
Member

Pilchie commented Aug 29, 2019

Note: Do to the expanding scope of this and lack of runway, we decided NOT to take this for 3.0, but we will plan to take it for 3.1 instead.

I believe @anurse had a couple of concerns with places we might have other bugs around async disposal too.

@kevinchalet
Copy link
Author

That's extremely unfortunate. Are you at least going to update DI to dispose IAsyncDisposable services in a blocking way on .NET Standard 2.0?

@Pilchie
Copy link
Member

Pilchie commented Aug 30, 2019

Are you at least going to update DI to dispose IAsyncDisposable services in a blocking way on .NET Standard 2.0?

Not for 3.0 at this point.

@JunTaoLuo JunTaoLuo changed the base branch from release/3.0 to release/3.1 September 3, 2019 18:05
Copy link

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased on release/3.1

@JunTaoLuo JunTaoLuo merged commit 1264b9e into dotnet:release/3.1 Sep 5, 2019
@JunTaoLuo
Copy link

Thanks @PinpointTownes! Unfortunately, this will only be available starting in 3.1

@kevinchalet
Copy link
Author

Thanks!

@kevinchalet kevinchalet deleted the async_disposal branch September 5, 2019 21:44
maryamariyan pushed a commit to maryamariyan/runtime that referenced this pull request Feb 28, 2020
…tensions#2137)

* Update DI to use Microsoft.Bcl.AsyncInterfaces for the net461 and netstandard20 TFMs

* Update Hosting to use Microsoft.Bcl.AsyncInterfaces for the netstandard20 TFM

* Make sure async disposal tests are executed on .NET Framework

* Multitarget more projects


Commit migrated from dotnet/extensions@1264b9e
maryamariyan pushed a commit to maryamariyan/runtime that referenced this pull request Mar 2, 2020
…tensions#2137)

* Update DI to use Microsoft.Bcl.AsyncInterfaces for the net461 and netstandard20 TFMs

* Update Hosting to use Microsoft.Bcl.AsyncInterfaces for the netstandard20 TFM

* Make sure async disposal tests are executed on .NET Framework

* Multitarget more projects


Commit migrated from dotnet/extensions@1264b9e
maryamariyan pushed a commit to maryamariyan/runtime that referenced this pull request Mar 11, 2020
…tensions#2137)

* Update DI to use Microsoft.Bcl.AsyncInterfaces for the net461 and netstandard20 TFMs

* Update Hosting to use Microsoft.Bcl.AsyncInterfaces for the netstandard20 TFM

* Make sure async disposal tests are executed on .NET Framework

* Multitarget more projects


Commit migrated from dotnet/extensions@1264b9e
maryamariyan pushed a commit to maryamariyan/runtime that referenced this pull request Mar 27, 2020
…tensions#2137)

* Update DI to use Microsoft.Bcl.AsyncInterfaces for the net461 and netstandard20 TFMs

* Update Hosting to use Microsoft.Bcl.AsyncInterfaces for the netstandard20 TFM

* Make sure async disposal tests are executed on .NET Framework

* Multitarget more projects


Commit migrated from dotnet/extensions@1264b9e
@ghost ghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants