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

Docs about "pattern-based usings" is incorrect #31815

Closed
rolfbjarne opened this issue Oct 18, 2022 · 1 comment · Fixed by dotnet/csharplang#6785
Closed

Docs about "pattern-based usings" is incorrect #31815

rolfbjarne opened this issue Oct 18, 2022 · 1 comment · Fixed by dotnet/csharplang#6785
Assignees
Labels
doc-bug Problem with the content; needs to be fixed [org][type][category] dotnet-csharp/svc help wanted Good for community contributors to help [up-for-grabs] lang-spec/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. Pri2 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Oct 18, 2022

The section about "pattern-based usings" is wrong. It states that pattern-based usings is a feature available for all types, but that's not the case according to:

which say that pattern-based usings only work for ref structs and in async scenarios.

And here's a sharplab repro for the example used in the broken documentation: https://sharplab.io/#v2:EYLgtghglgdgNAExAagD4AEAMACdBGAOgCUBXGAFyjAFMCBJC6gJwHsAHAZWYDcoBjagGcA3AFgAUBPQAmbAEE2bCQG8J2dbgDMuPADZcAFmwBZaDGwAKAJRqNq8Rse4cF7hCbYPAXmwxqAd2wiIRYSJgFrGwcndXsYmIB6BOxBcghyahoKQVsYgF9c7ALo7AliqVlgwVDw6hVSkq1DbAARKEE2FkFqa2xlIrKJIA===

error CS1674: 'Resource': type used in a using statement must be implicitly convertible to 'System.IDisposable'.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 32628

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Oct 18, 2022
@BillWagner BillWagner added the doc-bug Problem with the content; needs to be fixed [org][type][category] label Oct 24, 2022
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label Oct 24, 2022
@BillWagner BillWagner assigned BillWagner and unassigned BillWagner Oct 24, 2022
@BillWagner BillWagner added help wanted Good for community contributors to help [up-for-grabs] ⌚ Not Triaged Not triaged labels Oct 24, 2022
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label Oct 24, 2022
@BillWagner BillWagner moved this to 🔖 Ready in dotnet/docs October Sprint Oct 24, 2022
@BillWagner
Copy link
Member

Thanks for noting this @rolfbjarne

I've added it to our November sprint. I've also added the "help wanted" label, in case anyone wants to contribute a fix before I get to this.

@ghost ghost added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Oct 24, 2022
@BillWagner BillWagner assigned BillWagner and unassigned BillWagner Nov 7, 2022
@BillWagner BillWagner added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Nov 7, 2022
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Nov 7, 2022
@BillWagner BillWagner self-assigned this Dec 6, 2022
@BillWagner BillWagner moved this to 🔖 Ready in dotnet/docs December Sprint Dec 6, 2022
@BillWagner BillWagner moved this from 🔖 Ready to 🏗 In progress in dotnet/docs December Sprint Dec 8, 2022
BillWagner added a commit to BillWagner/csharplang that referenced this issue Dec 8, 2022
The proposal spec'ed this out in general terms for any type, and included a provision to allow extension `Dispose` methods.

The implementation only allows `ref` struct types to use the pattern-based Dispose. Furthermore, the `Dispose` method can't be an extension method.

Fixes dotnet/docs#31815

I made edits to make the proposal match the implementation. As an alternative, I could make edits to indicate which portions of the proposal were implemented and which may be delivered in the future.
Repository owner moved this from 🔖 Ready to ✅ Done in dotnet/docs November Sprint Dec 13, 2022
Repository owner moved this from 🏗 In progress to ✅ Done in dotnet/docs December Sprint Dec 13, 2022
BillWagner added a commit to dotnet/csharplang that referenced this issue Dec 13, 2022
The proposal spec'ed this out in general terms for any type, and included a provision to allow extension `Dispose` methods.

The implementation only allows `ref` struct types to use the pattern-based Dispose. Furthermore, the `Dispose` method can't be an extension method.

Fixes dotnet/docs#31815

I made edits to make the proposal match the implementation. As an alternative, I could make edits to indicate which portions of the proposal were implemented and which may be delivered in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug Problem with the content; needs to be fixed [org][type][category] dotnet-csharp/svc help wanted Good for community contributors to help [up-for-grabs] lang-spec/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. Pri2 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants