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

Debug: FS2014 duplicate `<f>__debug@N` in method table for an inline call inside a resumable CE whose `Run` has caller-info parameters (regression in 11.0.100-rc.2)

未关闭
#20,836 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

@auduchinok 已经在做这个了。

开始于 2026年10月22日。

  • #20846 来自 @auduchinok —— 未关闭

评估

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

调研方向

Start by building the supplied Lib.fs repro in Debug with SDK 11.0.100-rc.2, then compare the generated state-machine and closure output for the resumable and dynamic paths. The issue links #20469 and reports that both branches emit a specialized inline call under the same debug method name; inspect that lowering path and confirm the duplicate method entry is gone while the listed variations still behave as described.

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

描述

Needs-Triage
Repro

Lib.fs, in a net10.0 library, built with dotnet build -c Debug on SDK 11.0.100-rc.2.26504.105:

module Lib
#nowarn "3513"
open System.Runtime.CompilerServices
open System.Runtime.InteropServices
open Microsoft.FSharp.Core.CompilerServices
open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers

[<Struct; NoEquality; NoComparison>]
type D<'T> = { mutable Result: 'T }

type B() =
    member inline _.Delay([<InlineIfLambda>] f: unit -> ResumableCode<'D, 'T>) =
        ResumableCode<'D, 'T>(fun sm -> (f ()).Invoke(&sm))
    member inline _.Return(v: 'T) = ResumableCode<D<'T>, 'T>(fun sm -> sm.Data.Result <- v; true)
    member inline _.Run(code: ResumableCode<D<'T>, 'T>,
                        [<CallerLineNumber; Optional; DefaultParameterValue(0)>] line: int) : 'T =
        if __useResumableCode then
            __stateMachine<D<'T>, 'T>
                (MoveNextMethodImpl<D<'T>>(fun sm -> __resumeAt sm.ResumptionPoint; code.Invoke(&sm) |> ignore))
                (SetStateMachineMethodImpl<D<'T>>(fun _ _ -> ()))
                (AfterCode<D<'T>, 'T>(fun sm -> sm.Data.Result))
        else
            let mutable sm = ResumableStateMachine<D<'T>>()
            code.Invoke(&sm) |> ignore
            sm.Data.Result

let b = B()
let f () : int = b { return [ 3 ] |> List.sum }
Result
error FS2014: A problem occurred writing the binary 'obj/Debug/net10.0/refint/repro.dll': Error in pass2 for type Lib, error: duplicate entry '<sum>__debug@28' in method table
Narrowing
Variation rc.2 Debug
As above FS2014
-p:ProduceReferenceAssembly=false FS2014 (on the main dll instead of refint)
Run without the [<CallerLineNumber>] parameter builds
Body without an inline call (b { return 3 }) builds
task { return [ 3 ] |> List.sum } builds
Non-resumable builder with the same caller-info Run builds
Release builds
Same repro on SDK 11.0.100-rc.1.26425.128 (Debug) builds

In a builder of the same shape (no inline call in the body), rc.2 Debug now emits the state-machine struct and the dynamic-path closures for one CE, where rc.1 Debug emitted only the closure. So both branches of if __useResumableCode seem to survive, and an inline call in the body is specialized once per branch, under the same <f>__debug@<line> name. This looks related to #20469 ("Preserve resumable state-machine lowering in Debug"), merged between rc.1 and rc.2.

Found in https://github.com/ekonbenefits/FSharp.Interop.Dlr (its dlr { } builder has this Run shape), where any dlr { } that calls an inline function fails to build in Debug on rc.2: ekonbenefits/FSharp.Interop.Dlr#235.

主要语言
F#
星标
4.3k
派生
882
平均合并
4 天 20 小时
30 天内合并 PR
134

环境准备

在 Codespaces 中打开

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

从这里开始

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

dotnet/fsharp 的其他 Issue

查看 dotnet/fsharp 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

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