-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Async dispose pattern mini fixes #26269
Async dispose pattern mini fixes #26269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thank you. We'll when you make the suggested changes.
|
||
:::code language="csharp" id="dontdothis" source="snippets/dispose-async/ExamplePatterns.cs" highlight="9-10"::: | ||
|
||
> [!TIP] | ||
> Avoid this pattern as it could lead to unexpected behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being removed? This should stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, this is eligible for removal since it gives a tip on phenomenon that is focused in whole chapter. I my casual day I would not appreciate a tip on anything being right 100 % obvious.
Saving that regular C# programmer would not be recognizing an unacceptable pattern as not avoidance-worthy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➡️ Users frequently search for code, and then copy paste whichever result shows up without reading all the surrounding text. The callout here is intended to highlight (via color/page style) the fact that copying this result is problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm… If I skip that right above is quite big heading Unacceptable pattern should not this be a note then?
Hi again @Uzivatel919 - in discussing the proposed changes with both @bartonjs and @sharwell, they confirmed that the moving for the |
@IEvangelist, @bartonjs, @sharwell, I have to take an objection. Moving @IEvangelist, here are also another changes beside moving |
Summary
In commit order:
DisposeAsync
andDisposeAsyncCore
. Code showing nothing unsaid removal.AnotherAsyncDisposable
) is not conditional from-by consumer pattern. Thus is irrelevant to denote any responsibilities resulting from bad pattern on consumer side. It is not important whether variable is assigned or not. Important is that valid instance referred to byobjOne
DisposeAsync
is not called while it should and can be.Check also #26270.