Runtime: PhysicalFileProvider should implement IDisposable correctly

Created on 1 Sep 2020  路  3Comments  路  Source: dotnet/runtime

Description

This is code in PhysicalFileProvider:

https://github.com/dotnet/runtime/blob/aa5fdab9654d74bc6274c0b5d820272c8e859621/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs#L177-L194

There are at least 3 things wrong with it:

  1. It has a finalizer, but doesn't manage any native assets.
  2. It touches managed objects during its finalizer.
  3. It doesn't call GC.SuppressFinalize when it is directly disposed.

We should correctly implement the IDisposable pattern on this class.

area-Extensions-FileSystem bug up-for-grabs

All 3 comments

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

I will prepare a PR for this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericstj picture ericstj  路  152Comments

galvesribeiro picture galvesribeiro  路  185Comments

ghuntley picture ghuntley  路  158Comments

morganbr picture morganbr  路  225Comments

PureKrome picture PureKrome  路  157Comments