-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
PhysicalFileProvider and PhysicalFilesWatcher should implement IDisposable correctly #41918
Conversation
…Provider and PhysicalFilesWatcher
Tagging subscribers to this area: @maryamariyan |
Can you also remove the finalizers? Since these classes don't use native resources, they shouldn't have finalizers.
|
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.
Removing the Finalizers was a good step, but the extra changes are a step backwards. Can you add them back?
src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs
Outdated
Show resolved
Hide resolved
8e7ec12
to
2945fe0
Compare
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 great! Thanks for your help here @Marusyk.
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); |
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.
GC.SuppressFinalize(this);
is not necessary on types that don't have finalizers. You removed the finalizer below.
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 was discussed in #41918 (comment)
Changes in implementation of the IDisposable pattern for PhysicalFileProvider and PhysicalFilesWatcher
Fixes #41705
Please review
Thank you in advance