System.MissingMethodException when using certain methods from FSharp PowerPack and compiling to a Class Library

Viewed 1983

So I'm just getting started with F#, and I'm encountering a very weird issue where I get a System.MissingMethodException thrown when using certain methods from the FSharp PowerPack.

This does not happen for all methods in the same module. It also does not happen if I compile my assembly as an Application instead of a class library.

Reproduction steps:

  1. Create 2 assemblies, one Class Library and one Application.
  2. Add nunit.framework and the FSharp.PowerPack DLLs as references to both assemblies.
  3. Create the following test fixture in each assembly.

    open NUnit.Framework
    
    [<TestFixture>]
    type Tests() = class
    
        [<Test>]
        member self.OfSeq() =
            // Will always succeed
            Matrix.Generic.ofSeq [[1]] |> ignore
    
        [<Test>]
        member self.OfList() =
            // Will fail under certain conditions with a System.MissingMethodException
            Matrix.Generic.ofList [[1]] |> ignore
    end
    
  4. Compile both assemblies.
  5. Open each assembly in NUnit and run all the tests.

When I do this the Application runs just fine (all tests pass), but the Class Library fails with the following exception:

System.MissingMethodException : Method not found: 'Microsoft.FSharp.Math.Matrix`1<!!0> Generic.ofList(Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Collections.FSharpList`1<!!0>>)'.
   at Temp2.Tests.OfList()

What is going on here?

Another method that produces the issue is matrix.PermuteColumns.

Additional Info:

  • I'm compiling both assemblies for .NET 4.5
  • I'm compiling using Visual Studio 2012 RC
  • I'm using NUnit version 2.5.10.11092
  • I'm using FSharp PowerPack version 2.1.3.1 (though the DLL properties state that it's 2.0.0)

Let me know if there's additional information that would be of use.

2 Answers
Related