libgit2 / libgit2/libgit2sharp
No error message is provided when there is a Network Failure
未關閉
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 3.5k
- 分支
- 925
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Core.Ensure.HandleError 開始,沿著經過 Proxy.git_remote_fetch、Commands.Fetch 和 Commands.Pull 的錯誤路徑進行追蹤。重現 issue 中描述的網路異常時的 fetch,並檢查 native 錯誤是如何呈現的。完成的標準是:網路故障會產生一個帶有明確且有用的網路相關訊息的 exception,而不是 native library 的空訊息。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp, git
- 領域
- networking
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100