The following raises System.BadImageFormatException when built using the Debug configuration in Visual Studio 2013 with F# 3.1.1
The platform makes no difference, and neither does toggling "Prefer 32-bit".
However, the code will run successfully in F# Interactive and when built using the Release configuration.
Removing the type annotations from T.H makes the problem go away.
type T() =
member this.H<[<Measure>]'u> (x : int<'u>) = x
member this.F<[<Measure>]'u> (x : int<'u>) =
let g x =
g x // Raises System.BadImageFormatException
[<Measure>] type M
let main argv =
let result = T().F (LanguagePrimitives.Int32WithMeasure<M> 0)
printfn "Result: %A" result