Skip to content

Instantly share code, notes, and snippets.

@aspnetde
Created May 7, 2017 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspnetde/58fd5e7c1801fcde452400f149623412 to your computer and use it in GitHub Desktop.
Save aspnetde/58fd5e7c1801fcde452400f149623412 to your computer and use it in GitHub Desktop.
F# Interactive -> System.BadImageFormatException (Mono)
#r "System.Net.Http"
open System.Net.Http
type Foo = Foo of HttpRequestMessage
 F# Interactive for F# 4.1
 Freely distributed under the Apache 2.0 Open Source License
 For help type #help;;
 --> Referenced '/Library/Frameworks/Mono.framework/Versions/4.8.1/lib/mono/4.5-api/System.Net.Http.dll' (file may be locked by F# Interactive process)
 System.BadImageFormatException:
 File name: '/Library/Frameworks/Mono.framework/Versions/4.8.1/lib/mono/4.5-api/System.Net.Http.dll'
  at (wrapper managed-to-native) System.Reflection.Assembly:LoadFrom (string,bool)
  at System.Reflection.Assembly.LoadFrom (System.String assemblyFile) [0x00000] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0
  at Microsoft.FSharp.Compiler.AbstractIL.Internal.Library+Shim+DefaultFileSystem.Microsoft-FSharp-Compiler-AbstractIL-Internal-Library-Shim-IFileSystem-AssemblyLoadFrom (System.String fileName) [0x00001] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.convTypeRefAux (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeRef tref) [0x000e1] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.convTypeRef (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, System.Boolean preferCreated, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeRef tref) [0x00089] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.convTypeSpec (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, System.Boolean preferCreated, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeSpec tspec) [0x0000a] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.convTypeAux (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, System.Boolean preferCreated, Microsoft.FSharp.Compiler.AbstractIL.IL+ILType typ) [0x000fe] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] mapping, Microsoft.FSharp.Collections.FSharpList`1[T] x) [0x0001f] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Collections.ListModule.Map[T,TResult] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] mapping, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00001] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.convTypesToArray (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Collections.FSharpList`1[T] typs) [0x00008] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildMethodPass2 (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeRef tref, System.Reflection.Emit.TypeBuilder typB, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILMethodDef mdef) [0x00234] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv@1762-2.Invoke (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILMethodDef mdef) [0x00001] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Collections.ListModule.loop@226-27[T,TState] (Microsoft.FSharp.Core.OptimizedClosures+FSharpFunc`3[T1,T2,TResult] f, TState s, Microsoft.FSharp.Collections.FSharpList`1[T] xs) [0x00019] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Collections.ListModule.Fold[T,TState] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] folder, TState state, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00014] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildTypeDefPass2 (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Collections.FSharpList`1[T] nesting, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeDef tdef) [0x00069] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+buildTypeDefPass2@1768-2.Invoke (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeDef tdef) [0x00001] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Collections.ListModule.loop@226-27[T,TState] (Microsoft.FSharp.Core.OptimizedClosures+FSharpFunc`3[T1,T2,TResult] f, TState s, Microsoft.FSharp.Collections.FSharpList`1[T] xs) [0x00019] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Collections.ListModule.Fold[T,TState] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] folder, TState state, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00014] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildTypeDefPass2 (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Collections.FSharpList`1[T] nesting, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeDef tdef) [0x000e0] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv@1939-7.Invoke (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, Microsoft.FSharp.Compiler.AbstractIL.IL+ILTypeDef tdef) [0x0000c] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Collections.ListModule.loop@226-27[T,TState] (Microsoft.FSharp.Core.OptimizedClosures+FSharpFunc`3[T1,T2,TResult] f, TState s, Microsoft.FSharp.Collections.FSharpList`1[T] xs) [0x00019] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Collections.ListModule.Fold[T,TState] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] folder, TState state, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00014] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.buildModuleFragment (Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+cenv cenv, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, System.Reflection.Emit.AssemblyBuilder asmB, System.Reflection.Emit.ModuleBuilder modB, Microsoft.FSharp.Compiler.AbstractIL.IL+ILModuleDef m) [0x00038] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter.emitModuleFragment (Microsoft.FSharp.Compiler.AbstractIL.IL+ILGlobals ilg, Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter+emEnv emEnv, System.Reflection.Emit.AssemblyBuilder asmB, System.Reflection.Emit.ModuleBuilder modB, Microsoft.FSharp.Compiler.AbstractIL.IL+ILModuleDef modul, System.Boolean debugInfo, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] resolvePath) [0x0000c] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler.ProcessInputs (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger errorLogger, Microsoft.FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState istate, Microsoft.FSharp.Collections.FSharpList`1[T] inputs, System.Boolean showTypes, System.Boolean isIncrementalFragment, System.Boolean isInteractiveItExpr, Microsoft.FSharp.Collections.FSharpList`1[T] prefixPath) [0x001d5] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler.EvalParsedDefinitions (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger errorLogger, Microsoft.FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState istate, System.Boolean showTypes, System.Boolean isInteractiveItExpr, Microsoft.FSharp.Collections.FSharpList`1[T] defs) [0x00080] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell+clo@1796-270.Invoke (Microsoft.FSharp.Compiler.Interactive.Shell+FsiDynamicCompilerState istate) [0x00ab9] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.InteractiveCatch[a] (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger errorLogger, Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f, a istate) [0x00018] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] in <58000160ddab8ea7a745038360010058>:0
  at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <58000160ddab8ea7a745038360010058>:0
 --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0
  at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a] (Microsoft.FSharp.Control.AsyncBuilderImpl+Result`1[T] res) [0x00030] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a] (System.Threading.CancellationToken token, Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Core.FSharpOption`1[T] timeout) [0x000a3] in <5584aad2904cf4daa7450383d2aa8455>:0
  at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Core.FSharpOption`1[T] timeout, Microsoft.FSharp.Core.FSharpOption`1[T] cancellationToken) [0x00071] in <5584aad2904cf4daa7450383d2aa8455>:0
  at MonoDevelop.FSharpInteractive.CompletionServer.main@100[a] (System.IO.TextReader inStream, System.IO.TextWriter outStream, Microsoft.FSharp.Compiler.Interactive.Shell+FsiEvaluationSession fsiSession, System.Diagnostics.Process editorProcess, System.String currentInput) [0x0002d] in <58e292618f772086a74503836192e258>:0
@aspnetde
Copy link
Author

aspnetde commented May 7, 2017

What didn't work so far:

  • I tried to copy System.Net.Http.dll to another folder and have it referenced from there – same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment