by Nathan Sanders
on Stack Overflow
See other posts from Stack Overflow
or by Nathan Sanders
Published on 2010-05-27T14:13:56Z Indexed on 2010/06/01 17:03 UTC
Read the original article Hit count: 608
Here's my test code to isolate the problem:
open Microsoft.FSharp.Metadata [<EntryPoint>] let main args = let core = FSharpAssembly.FromFile @"C:\Program Files\FSharp-220.127.116.11\\bin\FSharp.Core.dll" let core2 = FSharpAssembly.FSharpLibrary let core3 = System.AppDomain.CurrentDomain.GetAssemblies() |> Seq.find (fun a -> a.FullName.Contains "Core") |> FSharpAssembly.FromAssembly core.Entities |> Seq.iter (printfn "%A") 0
lets should give me the same FSharpAssembly. Instead, all 3 throw an exception that FSharp.Core is not an F# assembly (details below, re-formatted for readability). Two more clues:
- Using the
core3method, I get the same error for the test F# assembly itself
- I don't get the error at FSI after doing
#r "@C:\Program Files...\FSharp.Powerpack.Metadata.dll".
Any ideas? I'm using Visual Studio 2008, F# 2.0 and F# Powerpack 18.104.22.168 (May 20, 2010) release on an oldish XP VM, I think it's updated to SP3 though.
(I got the error this morning with Powerpack 22.214.171.124, so I upgraded to 126.96.36.199. I thought that if 188.8.131.52 doesn't recognise F#'s 184.108.40.206's assemblies, then maybe bugfixes in Powerpack 220.127.116.11 would help.)
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.FSharp.Metadata.AssemblyLoader' threw an exception. ---> System.TypeInitializationException: The type initializer for '<StartupCode$FSharp-PowerPack-Metadata>.$Metadata' threw an exception. ---> System.ArgumentException: could not produce an FSharpAssembly object for the assembly 'FSharp.Core' because this is not an F# assembly Parameter name: name at Microsoft.FSharp.Metadata.AssemblyLoader.Add(String name,Assembly assembly) at <StartupCode$FSharp-PowerPack-Metadata>.$Metadata..cctor() --- End of inner exception stack trace --- at Microsoft.FSharp.Metadata.AssemblyLoader..cctor() --- End of inner exception stack trace --- at Microsoft.FSharp.Metadata.AssemblyLoader.Get(Assembly assembly) at Microsoft.FSharp.Metadata.FSharpAssembly.FromAssembly(Assembly assembly) at Program.main(String args) in C:\Documents an...\FSMetadataTest\Program.fs:line 11 Press any key to continue . . .
© Stack Overflow or respective owner