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:
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
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:
Let me know if there's additional information that would be of use.
(Answer for future reference since this Q was the first hit on searching.)
With Visual Studio 2013, with the "F# MSTest" online project template referenced by Brian, neither of Brian's suggestions helped (for a start the target of the testing is a library project without App.Config
).
However I eventually found that the test project was set to use F#3 runtime (with FSharp.Core V4.3.0.0). Changing this to F# v3.1 (FSharp.Core V4.3.1.0) fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With