Skip to content

Comments

Fix invalidating cache in the WatchingResolvePathTemplateManager when the source teplate file is renaming#7

Open
vladsm wants to merge 1 commit intofouadmess:masterfrom
vladsm:master
Open

Fix invalidating cache in the WatchingResolvePathTemplateManager when the source teplate file is renaming#7
vladsm wants to merge 1 commit intofouadmess:masterfrom
vladsm:master

Conversation

@vladsm
Copy link

@vladsm vladsm commented Jul 2, 2021

I'm using WatchingResolvePathTemplateManager to simplify template creation at the development time leveraging change-and-check iterative process without restarting my application.

When trying to change source template file in the Visual Studio it appears that template cache is not invalidating, while with changes in simple text editor everything works fine. The reason is Visual Studion makes files changes by creating temporal files and renaming them to editing ones after all.

In WatchingResolvePathTemplateManager files renamings was handled with emulating two other events: delete file and create file. The issue was in using FileSystemEventArgs constructor calling which accepts file directory as a second argument. But the full path of the file was passed to it. This causes wrong template file invalidating.

I fixed it by explicitly calling invalidating function for "deleted" and "created" files in "file renamed" event handler.

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