Skip to content

UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink_TargetChanged failed due to access denied #72902

@danmoseley

Description

@danmoseley

hit in #72885

Console log: 'Microsoft.Extensions.FileProviders.Physical.Tests' from job 29eb3134-8d82-44bd-8c8d-bf4be5fddd8a (windows.10.amd64.serverrs5.open.rt) using docker image mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504 on a000GKU
...
    Microsoft.Extensions.FileProviders.PhysicalFileProviderTests.UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink_TargetChanged(useWildcard: False, linkWasBroken: False) [FAIL]
      System.UnauthorizedAccessException : Access to the path 'C:\Windows\TEMP\#PhysicalFileProviderTests_r11jkav1.5tw\UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink_TargetChanged_93_jgdkh4un\UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink_TargetChanged_94_ykaupbe5' is denied.
      Stack Trace:
        /_/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateSymbolicLink.cs(59,0): at Interop.Kernel32.CreateSymbolicLink(String symlinkFileName, String targetFileName, Boolean isDirectory)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs(531,0): at System.IO.FileSystem.CreateSymbolicLink(String path, String pathToTarget, Boolean isDirectory)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/File.cs(1135,0): at System.IO.File.CreateSymbolicLink(String path, String pathToTarget)
        /_/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.netcoreapp.cs(110,0): at Microsoft.Extensions.FileProviders.PhysicalFileProviderTests.UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink_TargetChanged(Boolean useWildcard, Boolean linkWasBroken)
        --- End of stack trace from previous location ---

Each call to GetTestFilePath() returns a new path (randomness is added) so it's not some hangover from one of the other permutations of this test.

By the line number 94, we know this is the link file path. So

            File.Delete(linkPath);
            File.CreateSymbolicLink(linkPath, file2Path); // access denied to linkPath 

My guess is this was somehow caused by the delete immediately beforehand. Would it help to rename it out of the way instead (into temp) assuming that would not invalidate the assert after?

@jozkee

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