未找到F#方法:' Microsoft.FSharp.Collections.FSharpList`1'

时间:2016-12-22 12:42:52

标签: f# missingmethodexception

我在程序集中定义了以下类型:

type DatabaseDifferences = {missingTables: Table list}
type ComparisonResult = IsMatch | Differences of DatabaseDifferences

然后,当我尝试查看Table list DatabaseDifferences的长度时,从我的测试程序集开始1}}类型我收到以下错误: System.MissingMethodExceptionMethod not found: 'Microsoft.FSharp.Collections.FSharpList``1<Table> DatabaseDifferences.get_missingTables()'.

以下是重现该问题的简化测试:

let extractDifferences r =
    match r with
    | Differences(r') -> r'
    | _ -> failwith "expected databases to be different but they are a match"

[<Fact>]
let ``fail example``() =

    let d = Differences{missingTables = []} |> extractDifferences
    d.missingTables.Length |> should equal 0

如果我在与测试相同的程序集中声明类型,那么一切正常,例如,此代码通过(表类型仍在其他程序集中定义):

type diff = {missingTables: Table list}
type cr = IsMatch | Diffs of diff

let extract r =
    match r with
    | Diffs(r') -> r'
    | _ -> failwith "expected databases to be different but they are a match"

[<Fact>]
let ``fail example 2``() =

    let d = Diffs{missingTables = []} |> extract
    d.missingTables.Length |> should equal 0

我在两个程序集中使用F#核心版本4和.Net版本4.6.2 < / p>

0 个答案:

没有答案