libgit2 / libgit2/libgit2sharp
Access Violation on pushing to a new remote
Aberta
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C#
- Estrelas
- 3.5k
- Forks
- 925
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Reproduzir o fluxo de push fornecido no Windows 10 com .NET 6, concentrando-se em repository.Network.Push e no acesso a branch.IsTracking mostrado no stack trace. Inspecionar Branch.ResolveTrackedBranch e a chamada git_branch_upstream_name; o trabalho estará concluído quando uma branch local não rastreada produzir um erro comum em vez de uma violação de acesso.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp, git
- Domínio
- devtools
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 25/100