Skip to content
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

Fix event args generation for FileSystemWatcher of the WatchingResolvePathTemplateManager #537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lunatic174
Copy link

@Lunatic174 Lunatic174 commented Oct 25, 2018

The FileSystemEventArgs takes as argument the directory path, not the full path to the file:
https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemeventargs.-ctor?view=netframework-4.7.2
I tried to use WatchingResolvePathTemplateManager for debugging, but when you change template in Visual Studio it actually fires 7 events, for example (not exactly in that order):

  1. Created "DirectoryPath\vfg3ps5n.nrj~"
  2. Created "DirectoryPath\Filename.cshtml~RF432f4415.TMP"
  3. Deleted "DirectoryPath\Filename.cshtml~RF432f4415.TMP"
  4. Renamed "DirectoryPath\Filename.cshtml" -> "DirectoryPath\Filename.cshtml~RF432f4415.TMP"
  5. Renamed "DirectoryPath\vfg3ps5n.nrj~" -> "DirectoryPath\Filename.cshtml"
  6. Changed "DirectoryPath\vfg3ps5n.nrj~"
  7. Deleted "DirectoryPath\Filename.cshtml~RF432f4415.TMP"

So if we are looking for DirectoryPath\Filename.cshtml, it will be mentioned only in 'Renamed' event.
But it was not working correctly, because of wrong FileEventArgs parameters.

…ePathTemplateManager

The FileSystemEventArgs takes as argument directory path, not the full path to the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant