1

When debugging using the repository Network object the quick watch of the instance tells me all threads need to be running, which causes the message in the title. Not sure why this is the case but when doing the push I get that message.

This real issue here is why The push below will not work versus removing and re-adding the remote.

Code is below - all parameter values are valid. Commits to the local repo are working. Only signature that works is using the remote after a removal and re-add of the remote. Branch is correct in this case below.:

 private Repository GetGitRepo()
 {
      string path = Settings.GetSetting(Constants.GitRepositoryPath);

      Repository repo = new Repository(path);
            
      return repo;
 }

 using (var repo = GetGitRepo())
 {
      if(commit != null)
      {
          var options = new PushOptions();
          options.CredentialsProvider = new CredentialsHandler(
                  (_url, _user, _cred) => 
                   new UsernamePasswordCredentials() { Username = Settings.GetSetting(Constants.GitUsername), Password = Settings.GetSetting(Constants.GitPassword) });
                        
          repo.Network.Push(_workingBranch, options);
                            
      }

 }

Anyone else run across this issue or any idea what I may be missing?

Thanks in advance!

mservais
  • 570
  • 1
  • 7
  • 20
  • Where is this message coming from? It sounds like a message which a debugger would tell you, which means it has nothing to do with libgit2sharp. Are you getting an exception from libgit2sharp? What error do you have *from libgit2sharp*? – Carlos Martín Nieto May 29 '15 at 18:56
  • What code are you debugging? Yours or LibGit2Sharp by itself? – nulltoken May 29 '15 at 18:58
  • Maybe [this question](https://stackoverflow.com/questions/4460206/lazyt-the-function-evaluation-requires-all-threads-to-run) or [this post](http://blogs.msdn.com/b/eliofek/archive/2012/12/12/why-do-we-get-the-function-evaluation-requires-all-threads-to-run.aspx) could be helping? – nulltoken May 29 '15 at 19:00
  • Are you debugging a debug or retail build of libgit2sharp? Is this a libgit2sharp you have built locally? The "code is optimized" message could mean you are working with a non-debug build... – jamill May 29 '15 at 19:06
  • Debugging mine using "retail" version of libgit2sharp. The extent of libgit2sharp is the message is thrown on the push, likely something in my setup isn't correct or missing. – mservais May 29 '15 at 19:22
  • @nulltoken the question isn't as relevant to the issue but the post has some promise. – mservais May 29 '15 at 19:24
  • I was able to get past by removing and re-adding the remote again and that seems to have allowed me to perform the push. Would like to know why that would be different than using the branch signature of Push. – mservais May 29 '15 at 19:25
  • *"the message is thrown on the push"* -> I'm sorry, I'm having a hard time understanding this part. Is this a message displayed in the Quick Watch window, an exception that is thrown, a dialog box, ...? Could you please add a screenshot to your question? – nulltoken May 29 '15 at 19:29
  • Verbiage cleaned up - message prevents debugging real problem on push. – mservais Jun 01 '15 at 13:47
  • What error / exception are you getting from LibGit2Sharp? That might shed some light on the problem. – jamill Jun 01 '15 at 14:15
  • There is a thread Abort occurring and I am unable to debug appropriately to provide any exception. – mservais Jun 01 '15 at 14:53

1 Answers1

3

So here is what eventually worked. The message as stated in the question I think was masking another issue. Eventually removing and re-adding the remote eventually did the trick. Code posted below:

using (var repo = GetGitRepo())
{
    // clean remote by remove and re-add
    var remoteName = Settings.GetSetting(Constants.GitUsername);
    repo.Network.Remotes.Remove(remoteName);
    Remote remote = repo.Network.Remotes.Add(remoteName, Settings.GetSetting(Constants.GitServer));

    // build credentials to repo in PushOptions        
    var options = new PushOptions();
    options.CredentialsProvider = new CredentialsHandler(
                    (_url, _user, _cred) =>
                        new UsernamePasswordCredentials() { Username =   Settings.GetSetting(Constants.GitUsername), Password =   Settings.GetSetting(Constants.GitPassword) });

    var pushRefSpec = _workingBranch.CanonicalName;

    repo.Network.Push(remote, pushRefSpec, options);
}
mservais
  • 570
  • 1
  • 7
  • 20