Skip to content

GitCommandRunnerTests throw file in use exception during Class Initialization #3892

Open
@ssparach

Description

@ssparach

Dev Home version

Any latest version

Windows build number

No response

Other software

No response

Steps to reproduce the bug

Run FileExplorerGitIntegration.UnitTest. On the first run, GitCommandRunnerTests fail with the below:

TestBasicInvokeGitFunctionality
  Source: GitCommandRunnerTests.cs line 74
  Duration: < 1 ms

 Message: 
   Class Initialization method FileExplorerGitIntegration.UnitTest.GitCommandRunnerTests.ClassInitialize threw exception. System.IO.IOException: The process cannot access the file 'pack-fac19906ba9a2181e9b1cde3dcb317f0b52acb31.pack' because it is being used by another process..

 Stack Trace: 
   FileSystem.RemoveDirectoryRecursive(String fullPath, WIN32_FIND_DATA& findData, Boolean topLevel)
   FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
   GitCommandRunnerTests.ClassInitialize(TestContext context) line 44
   RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

Subsequent runs of the GitCommandRunnerTests are passing.

Expected result

Tests are less noisy and do not fail with file in use errors

Actual result

TestInvokeGitFunctionalityForRawStatus
 Source: GitCommandRunnerTests.cs line 89
 Duration: < 1 ms

Message: 
Class Initialization method FileExplorerGitIntegration.UnitTest.GitCommandRunnerTests.ClassInitialize threw exception. System.IO.IOException: The process cannot access the file 'pack-fac19906ba9a2181e9b1cde3dcb317f0b52acb31.pack' because it is being used by another process..

Stack Trace: 
FileSystem.RemoveDirectoryRecursive(String fullPath, WIN32_FIND_DATA& findData, Boolean topLevel)
FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
GitCommandRunnerTests.ClassInitialize(TestContext context) line 44
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

Included System Information

No response

Included Extensions Information

No response

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