libgit2 / libgit2/libgit2sharp

Access Violation on pushing to a new remote

Aperta
#1,981 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
3.5k
Fork
925
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Reproduction steps
  using var repository = new Repository(_options.LocalRepositoryPath);
            const string message = "message";
            var commitOptions = new CommitOptions()
            {
                AllowEmptyCommit = false,
                PrettifyMessage = true,
            };
            var authorSignature = new Signature(_options.Username, _options.Email, DateTimeOffset.UtcNow);

            await UpdateReadmeFile();

            repository.Index.Add("readme.md");
            repository.Index.Write();

            Commands.Stage(repository, "*");

            repository.Commit(message, authorSignature, authorSignature, commitOptions);

            PushOptions pushOptions = new PushOptions()
            {
                CredentialsProvider = (_, __, ___) => new DefaultCredentials(),               
            };

            _logger.LogInformation("Pushing changes to remote");
            _logger.LogDebug($"Branch has been tracked: {branch.IsTracking}");        

            repository.Network.Push(branch, pushOptions);
Expected behavior

Another error should occur when the local branch is not being tracked. But not an access violation exception.

Actual behavior

This craches with:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at LibGit2Sharp.Core.NativeMethods.git_branch_upstream_name(LibGit2Sharp.Core.Handles.GitBuf, LibGit2Sharp.Core.git_repository*, System.String)
--------------------------------
   at LibGit2Sharp.Core.Proxy.git_branch_upstream_name(LibGit2Sharp.Core.Handles.RepositoryHandle, System.String)
   at LibGit2Sharp.Branch.ResolveTrackedBranch()
   at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ViaFactory(System.Threading.LazyThreadSafetyMode)
   at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionAndPublication(System.LazyHelper, Boolean)
   at System.Lazy`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateValue()
   at LibGit2Sharp.Branch.get_IsTracking()
Version of LibGit2Sharp (release number or SHA1)
Operating system(s) tested; .NET runtime tested

OS: Windows 10 Professional
.NET runtime: NET 6.0

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre il flusso di push fornito su Windows 10 con .NET 6, concentrandosi su repository.Network.Push e sull’accesso a branch.IsTracking mostrato nello stack trace. Esaminare Branch.ResolveTrackedBranch e la chiamata git_branch_upstream_name; il lavoro è completato quando un branch locale non tracciato produce un errore ordinario invece di una violazione di accesso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, git
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.