Skip to content
This repository was archived by the owner on Nov 6, 2018. It is now read-only.
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Inconsistent behaviour between GetFileInfo & Watch #248

Closed

Description

@ycrumeyrolle

Take the following code :

        ChangeToken.OnChange(() => _fileProvider.Watch(@".\test.txt"), FileChanged);

        private void FileChanged()
        {
            var file = _fileProvider.GetFileInfo(@".\test.txt");
            _fileExists = file != null && file.Exists;
        }

Tried with a PhysicalFileProvider.
If I call the FileChanged() method directly, the file provider is functioning properly and providing information on the file.
If I change the file, the change is not watched and the ChangeToken does not trigger.

If I update the code by removing the trailing .\, the ChangeToken is also functioning properly :

        ChangeToken.OnChange(() => _fileProvider.Watch("test.txt"), FileChanged);

        private void FileChanged()
        {
            var file = _fileProvider.GetFileInfo("test.txt");
            _fileExists = file != null && file.Exists;
        }

The GetFileInfo do not consider the trailing .\ as invalid characters, but the Watch does.

Activity

  1. muratg commented on Mar 20, 2017

    @muratg

    @pranavkm thoughts?

  2. pranavkm commented on Mar 20, 2017

    @pranavkm
    Contributor

    Yeah, we should fix this. The issue is more pervasive and affect other relative paths for instance - /Views/Home/../Shared/_Layout.cshtml is a valid rooted path, but Watch doesn't work with this.
    We workaround this in Mvc (aspnet/Mvc@cfa9631) primarily because we wanted the view engine to work in a file provider agnostic way, but it would be good to resolve paths in PhysicalFileProvider too.

  3. added this to the 2.2.0 milestone on Nov 16, 2017
  4. aspnet-hello commented on Jan 1, 2018

    @aspnet-hello

    This issue was moved to aspnet/Home#2546

  5. locked and limited conversation to collaborators on Jan 1, 2018
  6. removed this from the 2.2.0 milestone on Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions