Search code examples
f#f#-datamissingmethodexceptionf#-4.0

System.MissingMethodException : Method not found: 'FSharp.Data.HttpResponse


I have written ATs for my application in F# using Tickspec. I am using FSharp.Data.Http.Request and I am getting the following error:

System.MissingMethodException : Method not found: 'FSharp.Data.HttpResponse     
FSharp.Data.Http.Request(System.String,  
Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Collections.FSharpList`1
<System.Tuple`2<System.String,System.String>>>,  
Microsoft.FSharp.Core.FSharpOption`1<System.Collections.Generic.IEnumerable`1
<System.Tuple`2<System.String,System.String>>>,   
Microsoft.FSharp.Core.FSharpOption`1<System.String>,   
Microsoft.FSharp.Core.FSharpOption`1<FSharp.Data.HttpRequestBody>,    
Microsoft.FSharp.Core.FSharpOption`1<System.Collections.Generic.IEnumerable`
1<System.Tuple`2<System.String,System.String>>>,
Microsoft.FSharp.Core.FSharpOption`1<System.Net.CookieContainer>, 
Microsoft.FSharp.Core.FSharpOption`1<Boolean>, 
Microsoft.FSharp.Core.FSharpOption`1<System.String>, 
Microsoft.FSharp.Core.FSharpOption`1<Microsoft.FSharp.Core.FSharpFunc`2
<System.Net.HttpWebRequest,System.Net.HttpWebRequest>>)'.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] 
arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, 
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at <StartupCode$TickSpec>.$TickSpec.createAction@212-1.Invoke()

FSharp.Data version is 2.1.1.0.

In fsproj:

ToolsVersion is 14.0

TargetFrameworkVersion is v4.6.1

F# is 4.0.

I have another set of ATs for a different application and I am using the same FSharp.Data.dll and the same Http.Request method and they use F# 4.0 and I encountered no problems.

I don't think there is any problem with the dll as I used it in a sample app and I was able to use that Http.Request method. I created a brand new solution as I thought maybe I was using an old version of FSharp.Core and still the same problem with FSharp.Data.

The only solution I found was to revert back to F#3.0 for that particular project. I do not want to use F#3.0 though as we have moved on to F#4.0 with all other application.

Any idea how to solve this?


Solution

  • Add an app.config or the following to any existing one. If you have multiple projects. i.e. test and application you will need to add it to both.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
      </startup>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>