Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 825ff27

Browse files
committed
[Git] Fix deadlock when running external authentication
Since all Git operations run on a dedicated thread, we can not simply run async tasks in callbacks from libgit. Running the external creds provider on a separate task fixes the deadlock.
1 parent 7f19cab commit 825ff27

File tree

1 file changed

+2
-1
lines changed
  • main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git

1 file changed

+2
-1
lines changed

main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
using MonoDevelop.Components;
3434
using System.Linq;
3535
using Mono.Addins;
36+
using System.Threading.Tasks;
3637

3738
namespace MonoDevelop.VersionControl.Git
3839
{
@@ -237,7 +238,7 @@ static GitCredentialsProviderResult GetCredentialsFromProvider (IGitCredentialsP
237238
if (type != SupportedCredentialTypes.UsernamePassword)
238239
return GitCredentialsProviderResult.NotFound;
239240

240-
var (result, credentials) = gitCredentialsProvider.TryGetCredentialsAsync (uri).Result;
241+
var (result, credentials) = Task.Run (() => gitCredentialsProvider.TryGetCredentialsAsync (uri)).Result;
241242

242243
if (result == GitCredentialsProviderResult.Found) {
243244
((UsernamePasswordCredentials)cred).Username = credentials.Username;

0 commit comments

Comments
 (0)