libgit2 / libgit2/libgit2sharp
Access Violation on pushing to a new remote
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C#
- Estrellas
- 3.5k
- Forks
- 925
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproducir el flujo de push proporcionado en Windows 10 con .NET 6, centrándose en repository.Network.Push y en el acceso a branch.IsTracking mostrado en el stack trace. Inspeccionar Branch.ResolveTrackedBranch y la llamada a git_branch_upstream_name; el trabajo estará terminado cuando una rama local sin seguimiento produzca un error normal en lugar de una violación de acceso.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, git
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100