-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fixing PhysicalFilesWatcher path maintenance (Issue #71386) #72041
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
@turnyanszki In the PR description, could you please describe the issue that you are fixing here? Also, add a short title for the PR. And reference any link for the issue, if there is one. |
Tagging subscribers to this area: @dotnet/area-system-configuration Issue Details#if NET5_0_OR_GREATER is needed beacuse the project is targeting .net framwork for some reason (analyzers maybe).
|
There is a link in the commit to the issue. |
Tagging subscribers to this area: @dotnet/area-extensions-filesystem Issue Details#if NET5_0_OR_GREATER is needed beacuse the project is targeting .net framwork for some reason (analyzers maybe).
|
@jozkee could you please give an idea when you will be able to review? This change seems small. |
@turnyanszki - looks like the new test you added to verify the bug fix is failing on .NET Framework. This is because you are only adding code for |
src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs
Outdated
Show resolved
Hide resolved
I dont want to implement the whole Path.GetFullPath method myself, and it does not exists in .NET Framework. |
…PhysicalFilesWatcher.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Looking at
This method is available on runtime/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs Lines 134 to 146 in 878354a
Which verifies that the |
#if NETCOREAPP | ||
var absolutePath = Path.GetFullPath(filePath, _root); | ||
filePath = absolutePath.Substring(_root.Length); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eerhardt suggestion, this should work for .NET Framework too:
#if NETCOREAPP | |
var absolutePath = Path.GetFullPath(filePath, _root); | |
filePath = absolutePath.Substring(_root.Length); | |
#endif | |
#if NETCOREAPP | |
string absolutePath = Path.GetFullPath(filePath, _root); | |
#else | |
string absolutePath = Path.GetFullPath(Path.Combine(_root, filePath)); | |
#endif | |
filePath = absolutePath.Substring(_root.Length); |
@@ -987,6 +987,41 @@ void ReloadLoop() | |||
} | |||
} | |||
|
|||
[Fact] | |||
public async Task ReloadingFileFiresOnChangeEvent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should be a Theory
and you should put ./reload.json
and reload.json
as InlineData
.
This pull request has been automatically marked |
This pull request will now be closed since it had been marked |
#if NET5_0_OR_GREATER is needed beacuse the project is targeting .net framwork for some reason (analyzers maybe).
All project should be refactored at this lib some point in my opinion.
fixes #71386