gitextensions / gitextensions

Git Extensions is a standalone UI tool for managing git repositories. It also integrates with Windows Explorer and Microsoft Visual Studio (2015/2017/2019).
https://gitextensions.github.io/
Other
7.77k stars 2.09k forks source link

Flaky FormBrowse tests #9750

Closed gerhardol closed 4 weeks ago

gerhardol commented 2 years ago

Environment

Issue description

The tests for FormBrowse are very flaky, many builds fails. At least the following symptoms:

These tests (at least those we see fail) should be disabled for now.

Steps to reproduce

Rebuild in AppVeyor, normally OK locally (the second issue I have seen locally too).

Did this work in previous version of GitExtensions?

This has always been an issue but I believe this got worse after the FormBrowse/Filter rework some time ago. I believe this is better with the tuned startup (including much reduced start time) in #9729, #9734, #9735 but it may still occur. I still would like to merge those PRs as the FormBrowse flow is simplified slightly.

Diagnostics

No response

gerhardol commented 2 years ago
************** Exception Text **************
GitExtUtils.ExternalOperationException: The directory name is invalid.
 ---> System.ComponentModel.Win32Exception (267): The directory name is invalid.
   at bool System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at new GitCommands.Executable+ProcessWrapper(string fileName, string prefixArguments, string arguments, string workDir, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 140
   --- End of inner exception stack trace ---
   at new GitCommands.Executable+ProcessWrapper(string fileName, string prefixArguments, string arguments, string workDir, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 140
   at IProcess GitCommands.Executable.Start(ArgumentString arguments, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 49
   at async Task<ExecutionResult> GitCommands.ExecutableExtensions.ExecuteAsync(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 347
   at void Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at T Microsoft.VisualStudio.Threading.JoinableTask<T>.CompleteOnCurrentThread()
   at ExecutionResult GitCommands.ExecutableExtensions.Execute(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 265
   at IReadOnlyList<string> GitCommands.GitModule.GetAllTagsWhichContainGivenCommit(ObjectId objectId) in C:/projects/gitextensions/GitCommands/Git/GitModule.cs:line 3150
   at async Task GitUI.CommitInfo.CommitInfo+<>c__DisplayClass56_0.<ReloadCommitInfo>g__LoadTagInfoAsync|5(?)+LoadTagInfoAsync(?) in C:/projects/gitextensions/GitUI/CommitInfo/CommitInfo.cs:line 490
   at async Task GitUI.CommitInfo.CommitInfo+<>c__DisplayClass56_0.<ReloadCommitInfo>b__2(?)+(?) => { } in C:/projects/gitextensions/GitUI/CommitInfo/CommitInfo.cs:line 382
   at async void GitUI.ThreadHelper.FileAndForget(Task task, Func<Exception, bool> fileOnlyIf)+(?) => { } in C:/projects/gitextensions/GitExtUtils/GitUI/ThreadHelper.cs:line 112

Another ocurrence

GitExtUtils.ExternalOperationException: The directory name is invalid.
 ---> System.ComponentModel.Win32Exception (267): The directory name is invalid.
   at bool System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at new GitCommands.Executable+ProcessWrapper(string fileName, string prefixArguments, string arguments, string workDir, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 140
   --- End of inner exception stack trace ---
   at new GitCommands.Executable+ProcessWrapper(string fileName, string prefixArguments, string arguments, string workDir, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 140
   at IProcess GitCommands.Executable.Start(ArgumentString arguments, bool createWindow, bool redirectInput, bool redirectOutput, Encoding outputEncoding, bool useShellExecute, bool throwOnErrorExit) in C:/projects/gitextensions/GitCommands/Git/Executable.cs:line 49
   at async Task<ExecutionResult> GitCommands.ExecutableExtensions.ExecuteAsync(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 347
   at void Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at T Microsoft.VisualStudio.Threading.JoinableTask<T>.CompleteOnCurrentThread()
   at ExecutionResult GitCommands.ExecutableExtensions.Execute(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 265
   at IReadOnlyList<string> GitCommands.GitModule.GetAllTagsWhichContainGivenCommit(ObjectId objectId) in C:/projects/gitextensions/GitCommands/Git/GitModule.cs:line 3150
   at async Task GitUI.CommitInfo.CommitInfo+<>c__DisplayClass56_0.<ReloadCommitInfo>g__LoadTagInfoAsync|5(?)+LoadTagInfoAsync(?) in C:/projects/gitextensions/GitUI/CommitInfo/CommitInfo.cs:line 490
   at async Task GitUI.CommitInfo.CommitInfo+<>c__DisplayClass56_0.<ReloadCommitInfo>b__2(?)+(?) => { } in C:/projects/gitextensions/GitUI/CommitInfo/CommitInfo.cs:line 382
   at async void GitUI.ThreadHelper.FileAndForget(Task task, Func<Exception, bool> fileOnlyIf)+(?) => { } in C:/projects/gitextensions/GitExtUtils/GitUI/ThreadHelper.cs:line 112

A related exception that were visible in an earlier version of #9735. This exception may be caused by the same problem though.

GitExtUtils.ExternalOperationException: fatal: not a git repository (or any of the parent directories): .git
 ---> System.Exception: fatal: not a git repository (or any of the parent directories): .git
   --- End of inner exception stack trace ---
   at async Task<ExecutionResult> GitCommands.ExecutableExtensions.ExecuteAsync(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 347
   at void Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at T Microsoft.VisualStudio.Threading.JoinableTask<T>.CompleteOnCurrentThread()
   at ExecutionResult GitCommands.ExecutableExtensions.Execute(IExecutable executable, ArgumentString arguments, Action<StreamWriter> writeInput, Encoding outputEncoding, CommandCache cache, bool stripAnsiEscapeCodes, bool throwOnErrorExit, CancellationToken cancellationToken) in C:/projects/gitextensions/GitCommands/Git/ExecutableExtensions.cs:line 265
   at IReadOnlyList<string> GitCommands.GitModule.GetRemoteNames() in C:/projects/gitextensions/GitCommands/Git/GitModule.cs:line 2165
   at IReadOnlyList<string> GitCommands.Remotes.ConfigFileRemoteSettingsManager.GetEnabledRemoteNames() in C:/projects/gitextensions/GitCommands/Remotes/ConfigFileRemoteSettingsManager.cs:line 198
   at IReadOnlyList<string> GitCommands.Remotes.ConfigFileRemoteSettingsManager.GetEnabledRemoteNamesWithoutBranches() in C:/projects/gitextensions/GitCommands/Remotes/ConfigFileRemoteSettingsManager.cs:line 210
   at async Task<Nodes> GitUI.BranchTreePanel.RepoObjectsTree+RemoteBranchTree.FillBranchTreeAsync(IReadOnlyList<IGitRef> branches, CancellationToken token)
   at async Task<Nodes> GitUI.BranchTreePanel.RepoObjectsTree+RemoteBranchTree.LoadNodesAsync(CancellationToken token, Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs) in C:/projects/gitextensions/GitUI/BranchTreePanel/RepoObjectsTree.RemoteBranchTree.cs:line 59
   at async Task GitUI.BranchTreePanel.RepoObjectsTree+Tree.ReloadNodesAsync(Func<CancellationToken, Func<RefsFilter, IReadOnlyList<IGitRef>>, Task<Nodes>> loadNodesTask, Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs) in C:/projects/gitextensions/GitUI/BranchTreePanel/RepoObjectsTree.Nodes.cs:line 320
   at async void GitUI.BranchTreePanel.RepoObjectsTree+Tree.UICommands_PostRepositoryChanged(object sender, GitUIEventArgs e)+(?) => { } in C:/projects/gitextensions/GitUI/BranchTreePanel/RepoObjectsTree.Nodes.cs:line 183
   at async void GitUI.ThreadHelper.FileAndForget(Task task, Func<Exception, bool> fileOnlyIf)+(?) => { } in C:/projects/gitextensions/GitExtUtils/GitUI/ThreadHelper.cs:line 112

Continue raises the following stacktrace in the log

System.OperationCanceledException : The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.VisualStudio.Threading.ThreadingTools.WithCancellationSlow(Task task, Boolean continueOnCapturedContext, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Threading.JoinableTaskCollection.JoinTillEmptyAsync(CancellationToken cancellationToken)
   at GitUI.ThreadHelper.JoinPendingOperationsAsync(CancellationToken cancellationToken) in C:\projects\gitextensions\GitExtUtils\GitUI\ThreadHelper.cs:line 118
   at CommonTestUtils.AsyncTestHelper.JoinPendingOperationsAsync(TimeSpan timeout) in C:\projects\gitextensions\UnitTests\CommonTestUtils\AsyncTestHelper.cs:line 26
   at GitExtensions.UITests.UITest.<>c__DisplayClass1_0`1.<<RunForm>b__0>d.MoveNext() in C:\projects\gitextensions\IntegrationTests\UI.IntegrationTests\UITest.cs:line 76
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.Threading.JoinableTask.JoinAsync(CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask.Join(CancellationToken cancellationToken)
   at GitExtensions.UITests.UITest.RunForm[T](Action showForm, Func`2 runTestAsync) in C:\projects\gitextensions\IntegrationTests\UI.IntegrationTests\UITest.cs:line 83
   at GitExtensions.UITests.CommandsDialogs.FormBrowseTests.RunFormTest(Func`2 testDriverAsync) in C:\projects\gitextensions\IntegrationTests\UI.IntegrationTests\CommandsDialogs\FormBrowseTests.cs:line 308
   at GitExtensions.UITests.CommandsDialogs.FormBrowseTests.RunFormTest(Action`1 testDriver) in C:\projects\gitextensions\IntegrationTests\UI.IntegrationTests\CommandsDialogs\FormBrowseTests.cs:line 298
   at GitExtensions.UITests.CommandsDialogs.FormBrowseTests.Filters_should_behave_as_expected() in C:\projects\gitextensions\IntegrationTests\UI.IntegrationTests\CommandsDialogs\FormBrowseTests.cs:line 123
gerhardol commented 2 years ago

The two tests that has failed where I have looked are now ignored in Release builds. Of course, they may just hide other failing tests, wait and see. One test was added recently, the other was modified recently (but they look OK). They should be restored.

gerhardol commented 2 years ago

The test instability may be related to #8583, git-remote is executed outside a Git repo