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