libgit2 / libgit2/libgit2sharp

No error message is provided when there is a Network Failure

Offen
#1,939 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
3.5k
Forks
925
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei Core.Ensure.HandleError und verfolge den Fehlerpfad durch Proxy.git_remote_fetch, Commands.Fetch und Commands.Pull. Reproduziere den im Issue beschriebenen fetch bei einem fehlerhaften Netzwerk und untersuche, wie native Fehler sichtbar gemacht werden. Als erledigt gilt dies, wenn ein Netzwerkausfall eine Exception mit einer expliziten, nützlichen netzwerkbezogenen Meldung erzeugt statt der leeren Meldung der nativen Bibliothek.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, git
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.