Skip to content

Static Assets -- what's happening? #40369

Closed
@dazinator

Description

@dazinator

I am really just looking for information around changes to static web assets in .net 6.

In .net 5, there was a relatively simple IFileProvider implementation for static assets. There was basically a manifest file with some root directories in, and when your application ran, the manifest was discovered, and file providers were set up to serve content from these directories. These file providers passed through much logic to PhysicalFileProvider which was quite nice because:

  • It was already a proven implementation of file provider
  • It has support for Watch and change notifications - which is useful when serving from a local directory for example.

I have recently upgraded to .NET 6 and I have discovered that the old manifest file format has now been replaced by a newer format, and a newer ManifestStaticWebAssetFileProvider.

  • This new format of manifest file looks to expanded a great deal in its complexity and size. (I am seeing mine used to be <1kb, in the new model it's 284kb).
  • The new file provider seemingly looks a bit more complex and puts more logic in front of the underlying PhysicalFileProvider (which was a proven implementation, so i.e risk of new bugs therefore increased with .net 6 in this area)
  • The new file provider doesn't seem to support Watch or change tokens anymore (even though the underlying physical file providers are capable of this) - which seems a degradation in functionality from before.. e.g it does this:
    public IChangeToken Watch(string filter) => NullChangeToken.Singleton;

Therefore given these perceived negatives, may I ask what the reason for the new provider and new manifest file is - i.e there must be reasons why it was necessary to make these changes, it would be very helpful to understand what is accomplished in this new model of dealing with static assets. Also I would be interested to know why Watch change tokens are deprecated (thinking of the scenario in local development where you edit a content file in a locally referenced project I would have though Watch would have been useful for enabling the app to respond - or is this not really the case?

Many Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions