libgit2 / libgit2/libgit2sharp

No error message is provided when there is a Network Failure

Abierto
#1,939 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

Use libgit2sharp in a bad network place

Expected behavior

Throw an exception that explicitly mentions network failure

Probably it's a good idea to handle situations where wifi signal is not strong or network failure. We could also handle this gracefully.

Actual behavior

Throws LibGit2Sharp.LibGit2SharpException saying

No error message has been provided by the native library

Stack trace,

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> LibGit2Sharp.LibGit2SharpException: No error message has been provided by the native library
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle remote, IEnumerable`1 refSpecs, GitFetchOptions fetchOptions, String logMessage)
   at LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable`1 refspecs, FetchOptions options, String logMessage)
   at LibGit2Sharp.Commands.Pull(Repository repository, Signature merger, PullOptions options)
   at GitUtil.Program.Main(String repoPath, String action, String filePath) in D:\git_ws\GitUtil\Program.cs:line 84
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0158 and earlier

Operating system(s) tested; .NET runtime tested

Win 10, .Net SDK 6.0.101

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en Core.Ensure.HandleError y sigue la ruta del error a través de Proxy.git_remote_fetch, Commands.Fetch y Commands.Pull. Reproduce el fetch con una red defectuosa descrito en el issue e inspecciona cómo se exponen los errores nativos. Se considera terminado cuando un fallo de red produce una excepción con un mensaje explícito y útil relacionado con la red, en lugar del mensaje vacío de la biblioteca nativa.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp, git
Área
networking
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.