Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`FSharpValue.PreComputeTuplePropertyInfo` reports an out-of-range index for every struct tuple

未关闭 适合新手
#20,801 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
64/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
fsharp

调研方向

首先,在 FSharp.Core 源代码及其元组反射测试中定位 FSharpValue.PreComputeTuplePropertyInfo。检查 struct 元组的处理方式,以及当前越界异常是如何产生的;issue 提供了可用的替代方案 PreComputeTupleReader 和 GetTupleField。当支持使用 struct 元组的调用,或在失败时抛出文档所述的 ArgumentException 并引导用户使用这些替代方案,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Bug Needs-Triage

FSharpValue.PreComputeTuplePropertyInfo fails for every index of a struct tuple type, and the message says that the index is out of range. That sends the reader to the wrong cause: a struct tuple keeps its items in fields, and the method returns a PropertyInfo.

Repro steps

open Microsoft.FSharp.Reflection

FSharpValue.PreComputeTuplePropertyInfo (typeof<struct (int * string)>, 0)

Expected behavior

Either support for struct tuples, or an ArgumentException that says that a struct tuple has no item properties and names FSharpValue.PreComputeTupleReader and FSharpValue.GetTupleField, which work for it.

Actual behavior

System.ArgumentException: The tuple index '0' was out of range for tuple type 'System.ValueTuple`2[[System.Int32, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. (Parameter 'index')

Known workarounds

FSharpValue.PreComputeTupleReader and FSharpValue.GetTupleField read struct tuples.

Related information

  • FSharp.Core 10.1.0.0, .NET SDK 10.0.402 (dotnet fsi), Windows 11
  • #4240 fixed FSharpValue.MakeTuple for struct tuples.
主要语言
F#
星标
4.3k
派生
881
平均合并
3 天 22 小时
30 天内合并 PR
105

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/fsharp 的其他 Issue

查看 dotnet/fsharp 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。