-
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
Low-erratic quality of examples of pattern #26270
Comments
Hi 👋 @Uzivatel919 Thank you so much for posting this issue. We really appreciate it. Discuss this issueList item number 1, you mentioned is acceptable quality and clear. Let's move on to list item number 2 - which contains three bullets. Bullet number 1:
When a class owns a field that either implements Bullet number 2:
Yes, the field initializers do not allow for them to be Bullet number 3:
There is no Future collaborationsI think we might find more success in our collaborations if you're to first create an issue and then give us a chance to reply to the issue before creating a pull request. We could have discussed the concerns here first to determine if they're valid concerns or not. And then used that as the basis whether or not a pull request was even necessary - and the extent of the changes being proposed. Is that fair? |
Good then. I understood it as cascading calls in hierarchy of base-derived classes. This is what I actually miss on this page.
This I know. Nobody needs to rely on
Since you stated they can be FMPV both methods should rely on definitely obvious protected virtual void Dispose(bool disposing)
{
// lock(_syncObject)
// {
if(_alreadyDisposed)
return;
// }
…
}
protected virtual async ValueTask DisposeAsyncCore()
{
// lock(_syncObject)
// {
if(_alreadyDisposed)
return;
// }
…
} In existing example designs null checks in disposal methods can be understand as representation of composed disposal state. In fact I understood it like this before you told me about hidden meaning encrypted in missing Then code can be straightforward as much as possible w/o any redundant
In fact I was doing it like this and then I was familiarized on that community is greatly welcomed to help in improvements and fixing the docs so I do it now like this. Specifically if I am sure, I know what I am doing and it is not much work, since I expect major reworks are property of regular employees. See for instance changes in #26192 that was approved w/o preceding issue. I am about to continue in my style of corrections so if you have any objections please tell them now or later but let be please accurate about what exactly is wrong, what should be better, avoided, improved, changed, made more friendly etc. |
Hi @Uzivatel919 -
Please post an issue first and allow time for someone on the team to discuss it before pushing a pull request. I've been heads down and missed #26192, but it had some issues that needed to be corrected in #26302. I'm happy to collaborate with you and help you continue to contribute, but we should strive to minimize unnecessary churn. Does that make sense? Thanks again |
Hmmmm… You are greatly are welcomed. I went through history and found exactly
See for instance #26064 (comment). For some reason in my memory it was fused/changed to something like “We'd appreciate any PRs that make updates.”. Now I understand the controversy. Please I have already some other PRs. These can be converted to issues or just checked. • dotnet/dotnet-api-docs#7209 |
Closed as part of #26269 |
null
state of_jsonWriter
as indicator of disposement and it is obviously made up as simplified.null
state checks on class variables but it this slightly more complicated – field initializers do not allow to any of them to benull
when either of disposal procedures will take its turn. So checkingnull
state of both of them inDispose(bool)
andDisposeAsyncCore
is slight overdo,?.
operator and the set variable tonull
in each case? Nonetheless both methods should rely on some_alreadyDisposed
bool
field
. Not combinativenull
checks. Bad conditional logic is also exercised in first example.Note that if there can happen situation when both
Dispose(bool)
andDisposeAsyncCore
are called (as examples suggest) state of variables should be synchronized (thread safe) as it likely can happen on different threads.This report works fine if changes in PR #26269 that address some direct failures are confirmed and merged.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: