F# Method not found : 'Microsoft.FSharp.Collections.FSharpList`1<Table>'

1.2k views Asked by At

I have the following types defined in my an assembly:

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

Then from my test assembly when I attempt to look at the length of the Table list on the DatabaseDifferences type I get the following error: System.MissingMethodExceptionMethod not found: 'Microsoft.FSharp.Collections.FSharpList``1<Table> DatabaseDifferences.get_missingTables()'.

Here is a cut down test that reproduces the issue:

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

If I declare the types in the same assembly as the tests then everything works, so for example this code passes (the Table type is still defined in the other assembly):

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

I am using F# core version 4 and .Net version 4.6.2 in both assemblies

0

There are 0 answers